savoirfairelinux / sous-chef

Sous-Chef is a web application to help organizations to plan and deliver meals, and to manage clients files.
GNU Affero General Public License v3.0
67 stars 45 forks source link

generateorders has misleading output #829

Open kousu opened 6 years ago

kousu commented 6 years ago

Actual Behaviour

As found in #828 :

$ /usr/bin/docker exec souschef_web_1 python src/manage.py generateorders 2018-02-27 --days 100

75 orders created on 2018-02-27: to be delivered on 2018-02-27.
...

but I checked the frontend, and the orders weren't created as far as I can tell: I would expect created orders to be in the Ordered state, but the Ordered state was empty for 2018-02-27, and instead most orders were in Delivered (due to manage.py setordersdelivered).

I'm guessing that whoever wrote generateorders wisely made it idempotent. That's the only way generated --days 100 ahead every night could be safe. I applaud this. But the logging statement is misleading.

Expected Behaviour

manage.py generateorders should accurately describe what it's doing to the database. It's a pretty powerful command and it's scary to run it without being able to see inside it. I want the output to be something more like

2018-02-27T21:00:00: 75 orders on to be delivered on 2018-02-27 (74 existing, 1 created).