iffy-pi / apple-shortcuts

A repository for handling the updates and versioning of my apple shortcuts
https://iffy-pi.github.io/apple-shortcuts/
2 stars 0 forks source link

Nutrition Framework - Logging 0 for Calories and maybe other nutrients #41

Closed iffy-pi closed 6 months ago

iffy-pi commented 6 months ago

Reported by user, a 0 value is being logged for calories.

Not sure when this started to happen as the shortcut was working earliest Nov 20th, that was the last time I used it. What could have changed?

iffy-pi commented 6 months ago

Just logged the food through the normal pipeline (i.e. through Log Foods At Time) and it worked, what is causing the issue?

iffy-pi commented 6 months ago

When going through the testing pipeline (using the test shortcut) it does not work but through the normal pipeline it does. I looked at the dictionary being passed to log nutrients to health and it is a dictionary where the calories and other nutrients are 0 values. This indicates that Log Algorithm is responsible for the bug, lets figure out the break point

iffy-pi commented 6 months ago

Update: It wasn't working in testing because I had my test config wrong (was missing the servings key). Now that I have it working in testing, I'll have to see why the user's place is not working

iffy-pi commented 6 months ago

Sent the user the testing shortcut: https://www.icloud.com/shortcuts/5f0b4c9f3e604d828a4467f251ceddf0, and I am asking for its output. Waiting on their response

iffy-pi commented 6 months ago

The user reported the issue occurs through "Saved Foods and Search" but not through Quick Log or other logging areas. This I was able to reproduce:

  1. Go to "Saved Foods And Search"
  2. Tap "Search and View"
  3. Tap "Log Entry"

The error occurs because there is no "Servings" key in the food dictionary passed to the Log Algorithm. This results in the amount of servings being evaluated to 0.

This can be fixed and prevented in future by adding a check for the "Servings" key within log algorithm itself

iffy-pi commented 6 months ago

Issue will remain open until we confirm fix with user, send them updated version of the shortcut

iffy-pi commented 6 months ago

User reported that "Log Foods At Time" was not working due to missing shortcut in run action, asked the user if they have the shortcut, but an alternative would be just sharing a shortcut that does the check to see they have all the necessary shortcuts installed.

iffy-pi commented 6 months ago

Shortcut sent to user: https://www.icloud.com/shortcuts/4b6b06638d4741df8e9f64d8f9ab51a2

iffy-pi commented 6 months ago

User hasn't responded in about two weeks :(, closing the issue