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 - Bug In Search Algorithm when food does not have full nutrients #29

Closed iffy-pi closed 9 months ago

iffy-pi commented 9 months ago

Bug occurs during contact vcard generation process for search results. If a food does not have the nutritional_contents.energy.value key, the shortcut throws a key error and stops execution.

Normally, a missing key would evaluate to an empty string but I believe it is the aspect of a nested key access for a missing key (that is, I am trying to access value when energy does not exist) that is causing the error.

To fix this, I can add checks to only generate the subtitle that uses the nutritional contents if the keys are available.