From 6282c374f7cac26951009ce6b22b86769f750384 Mon Sep 17 00:00:00 2001 From: Verox001 Date: Tue, 5 Mar 2024 09:59:09 +0100 Subject: [PATCH] Fixed habit times check --- app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.py b/app.py index 087d361..e4a9fa7 100644 --- a/app.py +++ b/app.py @@ -207,6 +207,10 @@ def habit_create(): except ValueError: errors['list_query'] = 'Die Anzahl muss eine Zahl sein.' + # Check if unit is day and times is one + if unit == 'Tag' and times == 1: + errors['times'] = 'Die Anzahl muss größer als 1 sein, wenn das Habit täglich ist.' + if errors: return render_template( 'habit.html', @@ -378,6 +382,9 @@ def edit_habit_change(): except ValueError: errors['list_query'] = 'Die Anzahl muss eine Zahl sein.' + if unit == 'Tag' and times == 1: + errors['times'] = 'Die Anzahl muss größer als 1 sein, wenn das Habit täglich ist.' + if errors: return render_template( "edit-habit.html",