From 14227f0058099764ac2d0b517a4a32d3bbe176fa Mon Sep 17 00:00:00 2001 From: moerp Date: Thu, 4 Apr 2024 13:37:36 +0200 Subject: [PATCH] cahnge --- src/templates/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/templates/index.html b/src/templates/index.html index c750d79..9892f71 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -159,13 +159,14 @@ function updateRowWithNewData(row, weight, nutritionData) { } + function addProduct() { const foodInput = document.getElementById('my_combobox'); const weightInput = document.getElementById('weight'); const portionsInput = document.getElementById('portions'); const food = foodInput.value; let weight = parseFloat(weightInput.value); - const portions = Math.max(parseInt(portionsInput.value, 10), 1); // Stellt sicher, dass mindestens 1 Portion angegeben wird + const portions = portionsInput.value ? parseInt(portionsInput.value, 10) : 1; // Teilen des Gewichts durch die Anzahl der Portionen und Aufrunden weight = Math.ceil(weight / portions);