sous-chef
sous-chef copied to clipboard
Order generation must preserve manual changes
https://github.com/savoirfairelinux/sous-chef/blob/396f86d696fd1dc541b6556dacea8a621e2b7420/src/order/models.py#L165-L172
-
Expected Behaviour
- When a customer calls to make changes affecting an order on a future date (tomorrow of later), I want to be able to change the quantities and contents of the order or to cancel the order.
- When a customer calls for changes in his meal defaults or schedule, I want the future orders to reflect the changes.
- When the status of a customer changes, I want the future orders to take this into account.
-
Actual Behaviour
- Once an order has been generated by the automatic cron job, its details are not updated when a client asks to change his(her) meal defaults or schedule.
- Once an order has been generated by the automatic cron job, it remains there even if the client status changes from active to something else for a period including the order delivery date.
-
Proposed solution
- When an order is manually created, modified or cancelled, remember the date + time of this action and call this "order modification date".
- When an order is manually created, modified or cancelled, using the Admin, the user will be responsible to put today's date + time in the field "order modification date".
- When orders are to be automatically generated nightly (for a
period of 100 days in the future) do the following :
- delete all orders in the database that have a null "order modification date" AND a delivery date >= today.
- create all orders in the future for "active ongoing" clients and set their "order modification date" to null, but do not replace the preexisting orders that have a non null "order modification date".
- In the Orders list page, show the "order modification date" and label this field as "manual creation/modification date" .
Also, I think that simply preventing the cron job from messing with manually modified orders could cause issues with side dish changes on manually generated orders. (i.e. episodic clients that order for the next month.)
This is a complex issue
- When a customer calls to make changes affecting an order on a future date (tomorrow of later), I want to be able to change the quantities and contents of the order or to cancel the order.
This works though, right ?