commented out
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
moerp 2024-04-04 12:15:35 +02:00
parent 7213cb4757
commit eddd739c71

View File

@ -111,24 +111,24 @@
document.getElementById('submit-button').disabled = !(food && weight); document.getElementById('submit-button').disabled = !(food && weight);
} }
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 = Math.max(parseInt(portionsInput.value, 10), 1); // Stellt sicher, dass mindestens 1 Portion angegeben wird
// 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);
fetch(`/add_lm?food=${encodeURIComponent(food)}&weight=${encodeURIComponent(weight)}`) // fetch(`/add_lm?food=${encodeURIComponent(food)}&weight=${encodeURIComponent(weight)}`)
.then(response => response.json()) // .then(response => response.json())
.then(data => { // .then(data => {
// Fügen Sie die verarbeitete Logik hier hinzu, wie zuvor // // Fügen Sie die verarbeitete Logik hier hinzu, wie zuvor
}) // })
.catch(error => console.error('Fehler:', error)); // .catch(error => console.error('Fehler:', error));
} // }
function addProduct() { function addProduct() {
const foodInput = document.getElementById('my_combobox'); const foodInput = document.getElementById('my_combobox');