From: Christian Heller Date: Mon, 2 Oct 2023 19:54:01 +0000 (+0200) Subject: Improve calories counter. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/do_todos?a=commitdiff_plain;h=35fe0ad6b60640e86add740c3b49dff05c75a240;p=misc Improve calories counter. --- diff --git a/calories.py b/calories.py index 54fb64e..7a4846a 100644 --- a/calories.py +++ b/calories.py @@ -296,12 +296,12 @@ class MyServer(BaseHTTPRequestHandler): "" % (db.eatables_selection(c.eatable_key), c.unit_count, r["cals"], r["sugar"]) day_rows = "" for date, day in db.days.items(): - day_rows += ""\ + day_rows = ""\ "%s"\ "%.1f"\ "%.1f"\ - "" % (date, date[:10], day.calories, day.calories, day.sugar_g, day.sugar_g) - day_rows += ""\ + "" % (date, date[:10], day.calories, day.calories, day.sugar_g, day.sugar_g) + day_rows + day_rows = ""\ "today:archive?"\ ""\ ""\ @@ -309,7 +309,7 @@ class MyServer(BaseHTTPRequestHandler): "%.1f"\ "%.1f"\ ""\ - "" % (db.today_date, db.today.calories, db.today.calories, db.today.sugar_g, db.today.sugar_g) + "" % (db.today_date, db.today.calories, db.today.calories, db.today.sugar_g, db.today.sugar_g) + day_rows page = build_page(eatables, consumptions, db.eatables_selection(), day_rows) self.wfile.write(bytes(page, "utf-8"))