Closed sentry-io[bot] closed 1 year ago
This was introduced when we changed the expected type of Marketplace#delivery_window
in https://github.com/zinc-collective/convene/pull/1251, but did not migrate the existing data in the https://piikup-sandbox.zinc.coop instance.
we are going from strings that mostly look like they were meant to be mostly time intervals, to one DateTime value, so there is really no good way to migrate this data.
I'm going to at least try to parse the existing string-type delivery windows to Dates, which will stop the 500s and whill gives us something like:
> m = Marketplace::Marketplace.all.select { |m| m.delivery_window.present? }
> m.map { |m| [m.id, m.delivery_window, begin DateTime.parse(m.delivery_window) rescue nil end] }
=>
[["3c2df6a3-f6b0-4e4e-b137-79860e8b28c9", "as needed", nil],
["f07fe90e-5a1d-43ca-aca2-fb8dfa70d915", "Same day 3pm - 6pm in Oakland , Berkeley and Alameda", Sat, 25 Mar 2023 15:00:00 +0000],
["dfb19803-7131-4443-ad6d-80cbc1f4571e", "Monday from 10AM to 2PM", Mon, 20 Mar 2023 10:00:00 +0000],
["0025198b-2196-4a26-96b1-921fb325ba84", "FRIDAY BETWEEN 3PM - 6PM", Fri, 24 Mar 2023 15:00:00 +0000],
["4bee9409-3ffa-4e49-b002-bbe3d63887fe", "BETWEEN 4:30 PM - 6PM", Sat, 25 Mar 2023 16:30:00 +0000]]
It feels like delivery windows really need to be a time interval, and we probably want a list of them in each Marketplace.
I have fixed the stored delivery windows, but we now have a different bug, where the cart returns its delivery window as a string:
undefined method `strftime' for "2023-03-20T10:00:00.000+00:00":String
value&.strftime("%Y-%m-%dT%T")
^^^^^^^^^^
Did you mean? strip
I left some comments in the other P.R. but one thing we want to keep in mind is that the Delivery Window is supposed to be pretty flexible; like they do want to preserve the ability to enter a plain string describing the delivery constraints until we get to the point where we've modeled it well.
So, Cart
s should have a Delivery
object that is the time they would like to receive the items, and the Marketplace
should have a DeliveryWindow
?DeliverySchedule
? Which is used to indicate what options a Shopper
has when ordering.
I've:
Which appears to have fixed the bug !