Skip to content

analyze_food edge case in analyze_recipe #5

@kevinsu628

Description

@kevinsu628

in cases where analyze_recipe creates a combined food (by calling combining nutrients), analyze_food may override existing values using the same nutrient_id (

elif nutrient_id == "calories":
)

        if nutrient_id == "protein":
            analysis.protein_per_serving = amount
        elif nutrient_id == "fat":
            analysis.fat_per_serving = amount
        elif nutrient_id == "carbs":
            analysis.carbs_per_serving = amount
        elif nutrient_id == "calories":
            analysis.calories_per_serving = amount

For example, energy with KJ and energy with KCal both have calories as nutrient_id. This happens often in the combined food. As a result, the latter will override the calories_per_serving with another amount, causing the previous amount overriden

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions