Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiply nutritional values by number of portions #18

Closed
1 of 3 tasks
MarcusWolschon opened this issue Jan 28, 2022 · 1 comment
Closed
1 of 3 tasks

Multiply nutritional values by number of portions #18

MarcusWolschon opened this issue Jan 28, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@MarcusWolschon
Copy link
Owner

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

Recipes state the nutritonal values per serving but Tandoor expects them to be for the entire meal and does scale them up/down when a different number of services is to be cooked

Describe alternatives you've considered

No response

Additional context

No response

Contribute

  • Yes
  • Partly
  • No
@MarcusWolschon
Copy link
Owner Author

You can convert existing Database entries by:

psql
list databases
\l

connect to database
\c Tandoor

list tables
\dt

update:

UPDATE cookbook_nutritioninformation  as n
SET fats = n.fats * r.servings , carbohydrates = n.carbohydrates * r.servings, proteins = n.proteins * r.servings, calories = n.calories * r.servings
FROM cookbook_recipe AS r
WHERE r.nutrition_id = n.id;

exit
\q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant