cahnge
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-04-04 13:37:36 +02:00
parent ed62772643
commit 14227f0058

View File

@ -159,13 +159,14 @@ function updateRowWithNewData(row, weight, nutritionData) {
} }
function addProduct() { function addProduct() {
const foodInput = document.getElementById('my_combobox'); const foodInput = document.getElementById('my_combobox');
const weightInput = document.getElementById('weight'); const weightInput = document.getElementById('weight');
const portionsInput = document.getElementById('portions'); const portionsInput = document.getElementById('portions');
const food = foodInput.value; const food = foodInput.value;
let weight = parseFloat(weightInput.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 // Teilen des Gewichts durch die Anzahl der Portionen und Aufrunden
weight = Math.ceil(weight / portions); weight = Math.ceil(weight / portions);