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

Add energy and kcal values to ingredient logging/adding forms #585

Merged
merged 8 commits into from
May 24, 2024

Conversation

Dieterbe
Copy link
Contributor

@Dieterbe Dieterbe commented May 19, 2024

When:

  1. logging an ingredient
  2. modifying a meal and adding or an ingredient

the app already shows you a list of recently used ingredients, as well a form with the ingredient, and amount.

what this PR does:

  1. on the list of recently used ingredients, show energy and macros of the ingredient on each tile
  2. on the form, give a preview of what you're about to log/add to the meal, in terms of energy and macros. updates values in real time as you change the amount.

this should be handy because often i log an entry (save the form), and then check my diary and realize it isn't quite what i wanted. this is especially true when you are dealing with an ingredient on your plate that doesn't have an exact match in the database, and you have to use something "similar": it's nice to be able to see if the values make sense before you log it.

I also added a couple of cleanups and refactors to this PR. notably, the 2 mentioned forms were quite similar, so i merged them into 1 class.

future work: add a warning icon to the list tile in case the ingredient is missing a field that you need to to track against a goal (e.g. fiber)

@Dieterbe Dieterbe force-pushed the show-macros-on-ingredients-tiles branch 2 times, most recently from e92409c to 3d1e6ed Compare May 21, 2024 12:02
@Dieterbe Dieterbe marked this pull request as ready for review May 21, 2024 12:20
@Dieterbe Dieterbe changed the title Show macros on ingredients tiles Add energy and kcal values to ingredient logging/adding forms May 21, 2024
@rolandgeider
Copy link
Member

does the preview only show when you select an ingredient from the quicklist?

@Dieterbe
Copy link
Contributor Author

Dieterbe commented May 23, 2024

the preview should not show if you don't have any ingredient in the form
once you click on a tile to fill the form, it should appear.
when you scan an ingredient (or use the search function and select a search result) and add the ingredient that way, it probably doesn't show the preview yet. I can work on that next though, there's a actually some weird behavior around the search/scan function (predating my changes) that i was planning to work on. if this PR looks good otherwise, i propose to merge it and i'll make another PR for the followup (when scanning works again :-)

@Dieterbe Dieterbe force-pushed the show-macros-on-ingredients-tiles branch from 1e6285b to eeec221 Compare May 23, 2024 18:01
@rolandgeider
Copy link
Member

there's a actually some weird behavior around the search/scan function (predating my changes) that i was planning to work on.

🚀

@rolandgeider rolandgeider merged commit c243215 into master May 24, 2024
4 checks passed
@Dieterbe Dieterbe deleted the show-macros-on-ingredients-tiles branch May 24, 2024 13:19
@Dieterbe
Copy link
Contributor Author

see #592 for followup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants