From: Shane Jaroch Date: Tue, 28 Jan 2025 02:21:06 +0000 (-0500) Subject: wip relative food prog bars X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=5586f45dadc46273acbe525deb2c6b0355eb9b34;p=nutratech%2Fcli.git wip relative food prog bars --- diff --git a/ntclient/services/analyze.py b/ntclient/services/analyze.py index 9104792..2a76a6e 100644 --- a/ntclient/services/analyze.py +++ b/ntclient/services/analyze.py @@ -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