home · contact · privacy
Minor calories counter improvement.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 4 Oct 2023 18:57:03 +0000 (20:57 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 4 Oct 2023 18:57:03 +0000 (20:57 +0200)
calories.py

index dc40d5ff9e58cfaabf14ca2c43c6841e42dbd0c4..5ab57044eb3bd7333f7764ab62938d071473e72b 100644 (file)
@@ -287,6 +287,7 @@ class MyServer(BaseHTTPRequestHandler):
                     "<td><input name=\"delete\" type=\"checkbox\" value=\"%s\" /></td>"\
                     "</tr>" % (k, v.title, v.cals, v.sugar_g, v.standard_g, v.comments, k)
         consumptions = ""
                     "<td><input name=\"delete\" type=\"checkbox\" value=\"%s\" /></td>"\
                     "</tr>" % (k, v.title, v.cals, v.sugar_g, v.standard_g, v.comments, k)
         consumptions = ""
+        db.consumptions = sorted(db.consumptions, key=lambda x: db.eatables[x.eatable_key].title)
         for c in db.consumptions:
             r = db.calc_consumption(c)
             consumptions += "<tr />"\
         for c in db.consumptions:
             r = db.calc_consumption(c)
             consumptions += "<tr />"\