recipes icon indicating copy to clipboard operation
recipes copied to clipboard

Nutrients not imported when servingSize is not set

Open nomad-debugger opened this issue 4 months ago • 1 comments

Tandoor Version

1.5.20

Setup

Docker / Docker-Compose

Reverse Proxy

Nginx Proxy Manager (NPM)

Other

No response

Bug description

When importing a recipe that does not get nutrients.servingSize set, Tandoor throws an exception and the nutrients do not get imported at all. Perhaps Tandoor can fall back to a serving size of 1 (because nutrient value most commonly refers to 1 serving) or ask the user to define this, to ensure the nutrients are not lost on import.

I've also come across a recipe that had the servingSize set to 1.5 cups (because one serving is 1.5 cup) which Tandoor then parses into 1.5 servings.

Relevant logs

'property_amount': parse_servings(property_data[properties[p]]) / parse_servings(property_data['servingSize'])

It throws a key error on servingSize.

nomad-debugger avatar Oct 12 '24 12:10 nomad-debugger