Questions:
N/D
Technical Refinement
Description
This activity should be considered a solution to Highlight current day to restaurants that close after midnight.
For example:
A restaurant with the following date:
Open → 10 am
Closes → 2 am
In this case, 2 am should be considered the next day at 2 am closing of the restaurant.
The period of this restaurant is CLOSED from 2 am to 10 am.
Acceptance criteria
Day on which the store status will be displayed:
The restaurant opens at 8 AM and closes at 2 AM every day.
If it is a Tuesday at 00:30 AM the status should be displayed on Monday, after 2 AM the status will be displayed on Tuesday.
The system needs some rules to understand that the closing date is from the previous day, and thus show the status on the previous day:
The Current date must be less than the opening date of the Current day;
The Current date must be less than the close date of the previous day;
The previous day's close date must be less than the previous day's open date;
Attention in these comparisons, the dates cannot be the same, for example the closing date of the previous day cannot be the same as the opening date of the current day.
Also, the opening date cannot be the same as the closing date, even if it is on the same day, it cannot open at 3 AM and close at 3 AM, it must be at least 1 minute apart, it opens at 3 AM and closes at 2:59 AM.
A date cannot be null, if one or 2 dates are null the system will inform you that the status is closed.
Status in Choose Restaurant
Screen to choose a restaurant, the status informed is based on a priority in sanity, usually it brings the status of Drive Thru, then Delivery, Dine in, this is an existing rule in the system and we have not modified it.
Here show some examples, we have 3 days “Monday, Tuesday, Wednesday", and the store works for the 12PM to 2AM, in the Monday and Tuesday, and stay closed on Wednesday, follow the flow of status.
...
intl-whitelabel-app
TASK 1— Change the component rule to status
path:
intl-whitelabel-app/workspaces/frontend/src/components/store-status/hooks/use-store-status.ts
We will create a feature flag:
enable-close-hours-status-after-midnight
We will have to change the component rule to consider the closing time after midnight
The idea is:
When the close hours are less than the open hours, we will add on close hours, 1 day.
Currently:
open: 10 am (2024/01/01)
close: 2 am (2024/01/01)
After the change, will be:
open: 10 am (2024/01/01)
close: 2 am (2024/01/02)
The change will be on hook:
useStoreStatus
on method:getStoreStatus
, before if conditions.Task objectives (DOD-like):
Don’t impact the rules current status
The status should follow the same rules from other flows of “normal hours”.
Closed Today
Closes at hh:mm(60 min before)
Open at hh:mm(60 min before)
Open now
Closed now
Screenshots
N/A
POC
Code Block | ||
---|---|---|
| ||
closeDate = closeDate < openDate ? add(closeDate, { days: 1 }) : closeDate; |
Impact Analysis
Currently highlight
Dependencies
N/A
Unit Test
N/A
Useful Links
N/A