Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marketplace factories produce inconsistent data, making it harder to debug mailer previews #2263

Open
rosschapman opened this issue Mar 1, 2024 · 1 comment
Labels
🐞 bug Something isn't working 🛠️ infrastructure ci, build, deploy, networking, etc. 🌱 Ready for Dev Stuff we are able to move forward on

Comments

@rosschapman
Copy link
Contributor

rosschapman commented Mar 1, 2024

Here's an example of a mailer preview for a received order notification:

image

You'll notice the order IDs do not match. With @anaulin's help during ensemble, we attempted to detangle the marketplace factory setup so that the clicking the link from the mailer preview would show the Order correctly inside the correct Space and Marketplace. I think we probably helped a little, but we still encountered a blank page when trying to access the Order page as the guest shopper. It would appear the data is still wrong.

Here's some example querying from the Rails console that demonstrates how the associated Marketplace for the Order is different than the Marketplace associated with the Order's products. In fact, it would appear an entirely new Marketplace is created for each product 😅:

irb(main):009> o.marketplace.id
=> "809e2464-6fd8-46e3-901a-bc7531eeb83a"
irb(main):010> o.products
  Marketplace::Product Load (0.6ms)  SELECT "marketplace_products".* FROM "marketplace_products" INNER JOIN "marketplace_cart_products" ON "marketplace_products"."id" = "marketplace_cart_products"."product_id" WHERE "marketplace_cart_products"."cart_id" = $1 /* loading for pp */ LIMIT $2  [["cart_id", "293b0f05-dc8e-4aff-ad57-a67db6d266c3"], ["LIMIT", 11]]
=> 
[#<Marketplace::Product:0x0000000109d5a8b8
  id: "a1db8be8-f8d9-43e2-9a80-2ca2e4e049c4",
  marketplace_id: "e3a701ea-c7d7-4498-9f7c-dbc6c22f3bff",
  name: "Chula",
  price_cents: 23200,
  price_currency: "USD",
  created_at: Thu, 29 Feb 2024 02:34:27.289318000 UTC +00:00,
  updated_at: Thu, 29 Feb 2024 02:34:27.289318000 UTC +00:00,
  discarded_at: nil,
  servings: nil>,
 #<Marketplace::Product:0x000000010ac73fc0
  id: "a887f718-1c6f-48f2-acce-b502b3d14695",
  marketplace_id: "d0388371-3f74-4212-bdac-cc56047c155b",
  name: "Pied Piper",
  price_cents: 62854,
  price_currency: "USD",
  created_at: Thu, 29 Feb 2024 02:34:27.652712000 UTC +00:00,
  updated_at: Thu, 29 Feb 2024 02:34:27.652712000 UTC +00:00,
  discarded_at: nil,
  servings: nil>,
 #<Marketplace::Product:0x000000010ac73e80
  id: "42610fac-623e-4308-bf57-e28df4b0baed",
  marketplace_id: "b6a23e1b-6dcb-4396-b9e4-1d19a41d44e4",
  name: "Arcateenian",
  price_cents: 11886,
  price_currency: "USD",
  created_at: Thu, 29 Feb 2024 02:34:27.995171000 UTC +00:00,
  updated_at: Thu, 29 Feb 2024 02:34:27.995171000 UTC +00:00,
  discarded_at: nil,
  servings: nil>,
 #<Marketplace::Product:0x000000010ac73d40
  id: "61da37b7-b902-401d-ae85-7737211508e0",
  marketplace_id: "858e3f49-4a9f-4e2f-8774-13650f7493de",
  name: "Chameleon",
  price_cents: 79086,
  price_currency: "USD",
  created_at: Thu, 29 Feb 2024 02:34:28.345043000 UTC +00:00,
  updated_at: Thu, 29 Feb 2024 02:34:28.345043000 UTC +00:00,
  discarded_at: nil,
  servings: nil>]
@rosschapman rosschapman added the 🐞 bug Something isn't working label Mar 1, 2024
@zspencer zspencer added the 🛠️ infrastructure ci, build, deploy, networking, etc. label Mar 1, 2024
@zspencer
Copy link
Member

zspencer commented Mar 1, 2024

I think the bug label makes sense, I've also added the infrastructure label since it's more about how we carry our client's burdens / create their benefits rather than something directly client-forward.

@anaulin anaulin added the 🌱 Ready for Dev Stuff we are able to move forward on label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🛠️ infrastructure ci, build, deploy, networking, etc. 🌱 Ready for Dev Stuff we are able to move forward on
Projects
None yet
Development

No branches or pull requests

3 participants