sd
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
2024-04-07 20:00:16 +02:00
parent 0ad4c9e398
commit e66e54c424

View File

@ -53,12 +53,18 @@ def calculate_nutrition(food, weight):
conn.close() conn.close()
def schulrunden(zahl):
def schulrunden(zahl, stellen=0):
faktor = 10 ** stellen
zahl = zahl * faktor
basis = floor(zahl) basis = floor(zahl)
if zahl - basis >= 0.5: if zahl - basis >= 0.5:
return basis + 1 gerundet = basis + 1
else: else:
return basis gerundet = basis
return gerundet / faktor
# Index-Route # Index-Route