]> Nutra Git (v1) - nutratech/cli.git/commitdiff
wip relative food prog bars
authorShane Jaroch <chown_tee@proton.me>
Tue, 28 Jan 2025 02:21:06 +0000 (21:21 -0500)
committerShane Jaroch <chown_tee@proton.me>
Tue, 28 Jan 2025 02:21:06 +0000 (21:21 -0500)
ntclient/services/analyze.py

index 9104792f4f07cfb690e7b2726639384c04c28712..2a76a6e428f1517591b4ea58e4a6254f673a21a2 100644 (file)
@@ -129,12 +129,16 @@ def foods_analyze(food_ids: set, grams: float = 100) -> tuple:
         # Add to list of lists
         nutrients_rows.append(nutrient_rows)
 
+        # Calculate stuff
+        _kcal = next((x[1] for x in nut_val_tuples if x[0] == NUTR_ID_KCAL), 0)
+
         # Print view
         # TODO: either make this function singular, or handle plural logic here
+        # TODO: support flag --absolute (use 2000 kcal; dont' scale to food kcal)
         _food_id = list(food_ids)[0]
         nutrient_progress_bars(
             {_food_id: grams},
-            [(_food_id, x[0], x[1]) for x in analyses[_food_id]],
+            [(_food_id, x[0], x[1] * (grams / 100)) for x in analyses[_food_id]],
             nutrients,
         )
         # TODO: make this into the `-t` or `--tabular` branch of the function