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

Surprise Duplicate Order Items #836

Open kousu opened 6 years ago

kousu commented 6 years ago

Expected Behaviour

Creating an order should create one row per item group.

Actual Behaviour

It is possible to create, e.g., multiple Puddings. They are not coalesced into a single row on the route sheets or order page.

Steps to reproduce


Strangely, setting the same value for Diabetic but also adding numbers for the other fields works correctly:

screenshot_2018-07-04 place orders

screenshot_2018-07-04 orders

erozqba commented 6 years ago

Good catch! Could you investigate further into the code? I will try to look to.

JeanFrancoisFournier commented 6 years ago

This behavior is probably fine.

It really has to do with the fact that the first side dish computed is "non-billable" and comes free with the meal.

Ex. an order of 1 Main, 1 Pudding would show up as 2 items. The pudding being "non-billable".

All other addition of side dishes (even if it's just another unit of the same side dish ordered and flagged as "non-billable" are considered EXTRAS and should be billed. As the value of "billable" can only be a TRUE or FALSE value, all extras will have a separate item entry.

Ex. an order of 1 Main, 2 Pudding would show up as 3 items. The first pudding being "non-billable" and the second being "billable"

Does this explain the behavior?