From 0e3baa007880c4c6c27899df85f9ff21626f7c36 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 8 Oct 2023 22:08:08 +0200 Subject: [PATCH] To calorie counter, float Consumption.unit_count. --- calories.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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"\ -- 2.30.2