Fixed type error

This commit is contained in:
Verox001 2024-01-23 10:46:52 +01:00
parent a33e349f63
commit f0f1b38eb0

8
app.py
View File

@ -176,13 +176,13 @@ def habit_create():
# Check if times is an integer
try:
times = int(times)
# Check that times is greater than 0
if times <= 0:
errors['times'] = 'Die Anzahl muss größer als 0 sein.'
except ValueError:
errors['times'] = 'Die Anzahl muss eine Zahl sein.'
# Check that times is greater than 0
if times <= 0:
errors['times'] = 'Die Anzahl muss größer als 0 sein.'
# Check that unit is valid
if unit not in ['Tag', 'Woche', 'Monat', 'Jahr']:
errors['unit'] = 'Die Einheit ist ungültig.'