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

Diabetic desserts causing confusing line break on printed route sheets #833

Closed JeanFrancoisFournier closed 4 years ago

JeanFrancoisFournier commented 6 years ago

Expected Behaviour

The string "Diabetic Dessert" in individual orders on the route sheets should be switched to "Diabetic" only as this proves to be be too long for the actual layout of the printed route sheet and makes it so it's printed on two lines therefore not aligned with the number count of the items to be delivered. This confuses volunteers making the actual delivery and is a source of delivery mistakes.

Once fixed, it should look like:

Main Dish 2 Diabetic 1 Green Salad 1

Actual Behaviour

Example of what an order for 1 main, 1 diabetic dessert and 1 green salad looks like on a route sheet:

Main Dish 2 Diabetic 1 Dessert 1 Green Salad

kousu commented 6 years ago

I'd suggest that the real error here is that the PDF generator assumes all Meal Components will fit on a single line. It sounds like it must be laying out by columns: first all names, then all numbers, instead of going name, number, name, number ....

The fix is to look at the PDF generation code and figure out why it isn't behaving itself; maybe it's using an HTML template, and in that case maybe we can change a CSS white-space:nowrap; or overflow: hidden to fix it. Maybe there's an option in the PDF generator API we can use.


But the quick fix is as @JeanFrancoisFournier suggests, and I will find and apply that right now.

kousu commented 6 years ago

The string is defined here:

https://github.com/savoirfairelinux/sous-chef/blob/396f86d696fd1dc541b6556dacea8a621e2b7420/src/meal/models.py#L7

but actually changing it requires running manage.py makemigrations then manage.py migrate on each instance we have of Sous-Chef so it's a bit more complicated.

erozqba commented 6 years ago

@JeanFrancoisFournier @kousu Could you upload an example of the PDF?

JeanFrancoisFournier commented 6 years ago

@erozqba Nice to see you again! Nick did a quick patch on our PROD version to fix this issue but it seems it created some minor UI issues.

JeanFrancoisFournier commented 6 years ago

@kousu could you explain to Ernesto what you did? And maybe get his 2 cents on the Docker issue?

JeanFrancoisFournier commented 5 years ago

This was solved in-house by @kousu.

JeanFrancoisFournier commented 5 years ago

Nick's changes at #837 are what fixed it on our copy.

JeanFrancoisFournier commented 4 years ago

The work around solution of shortening the side dish name from Diabetic dessert to Diabetic solves this issue.

The only thing is that we will need to keep that in mind if we ever add another side option and give it a short name that won't affect the line-break display.