This commit is contained in:
@ -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);
|
||||||
|
Reference in New Issue
Block a user