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);