From: Christian Heller Date: Tue, 10 Oct 2023 20:23:01 +0000 (+0200) Subject: Improve calorie counter formatting. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/process?a=commitdiff_plain;h=40f30842115407c2c319aab3890465abd217843e;p=misc Improve calorie counter formatting. --- diff --git a/calories.py b/calories.py index 5f71087..048aacc 100644 --- a/calories.py +++ b/calories.py @@ -10,12 +10,10 @@ def build_page(eatable_rows, consumption_rows, eatables_selection, day_rows): return """ """ + f"""
@@ -29,7 +27,7 @@ td, th { - + @@ -45,9 +43,9 @@ td, th { - - - + + + @@ -280,9 +278,9 @@ class MyServer(BaseHTTPRequestHandler): eatables += ""\ ""\ ""\ - ""\ - ""\ - ""\ + ""\ + ""\ + ""\ ""\ ""\ "" % (k, v.title, v.cals, v.sugar_g, v.standard_g, v.comments, k) @@ -293,26 +291,26 @@ class MyServer(BaseHTTPRequestHandler): consumptions += ""\ ""\ "%s"\ - ""\ + ""\ ""\ - "%.1f"\ - "%.1f"\ + "%.1f"\ + "%.1f"\ "" % (c.eatable_key, db.eatables[c.eatable_key].title, c.unit_count, r["cals"], r["sugar"]) day_rows = "" for date in sorted(db.days.keys()): day = db.days[date] day_rows = ""\ "%s"\ - "%.1f"\ - "%.1f"\ + "%.1f"\ + "%.1f"\ "" % (date, date[:10], day.calories, day.calories, day.sugar_g, day.sugar_g) + day_rows day_rows = ""\ "today:archive?"\ ""\ ""\ ""\ - "%.1f"\ - "%.1f"\ + "%.1f"\ + "%.1f"\ ""\ "" % (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)