From: Christian Heller Date: Sun, 8 Oct 2023 20:08:08 +0000 (+0200) Subject: To calorie counter, float Consumption.unit_count. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/gitweb.css?a=commitdiff_plain;h=0e3baa007880c4c6c27899df85f9ff21626f7c36;p=misc To calorie counter, float Consumption.unit_count. --- diff --git a/calories.py b/calories.py index 5ab5704..23234b2 100644 --- a/calories.py +++ b/calories.py @@ -29,7 +29,7 @@ td, th { - + @@ -62,7 +62,7 @@ for (let i = 0; i < unit_count_inputs.length; i++) { button.innerHTML = '+1'; button.onclick = function(event) { event.preventDefault(); - input.value = parseInt(input.value) + 1; + input.value = parseFloat(input.value) + 1.0; }; input.insertAdjacentElement('afterend', button); } @@ -253,7 +253,7 @@ class MyServer(BaseHTTPRequestHandler): if c.unit_count > 0: db.eatables[c.eatable_key].popularity += 1 db.consumptions = [] - default_slots = 7 + default_slots = 10 for k, v in sorted(db.eatables.items(), key=lambda item: -item[1].popularity): db.add_consumption(Consumption(k, 0)) default_slots -= 1 @@ -293,7 +293,7 @@ class MyServer(BaseHTTPRequestHandler): consumptions += ""\ ""\ ""\ - ""\ + ""\ ""\ "%.1f"\ "%.1f"\