From: Shane Jaroch Date: Mon, 26 Feb 2024 03:06:37 +0000 (-0500) Subject: fix quadratic with -g | --grams X-Git-Tag: v0.2.8.dev0~6 X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=c0c85b42df8596c4fcfde83a62845141b1979bed;p=nutratech%2Fcli.git fix quadratic with -g | --grams --- diff --git a/ntclient/core/nutprogbar.py b/ntclient/core/nutprogbar.py index d23a91d..9f30dd6 100644 --- a/ntclient/core/nutprogbar.py +++ b/ntclient/core/nutprogbar.py @@ -43,14 +43,13 @@ def nutrient_progress_bars( # Tally the nutrient totals nut_amts = {} - for food_id, grams in _food_amts.items(): - ratio = grams / 100.0 + for food_id in _food_amts.keys(): analysis = food_analyses_dict[food_id] for nutrient_id, amt in analysis.items(): if nutrient_id not in nut_amts: - nut_amts[int(nutrient_id)] = amt * ratio + nut_amts[int(nutrient_id)] = amt else: - nut_amts[int(nutrient_id)] += amt * ratio + nut_amts[int(nutrient_id)] += amt print_bars() return nut_amts