From 4fd34ba5bc3118b6b12cc6a094b044c0c2eb7814 Mon Sep 17 00:00:00 2001 From: Verox001 Date: Fri, 26 Jan 2024 10:09:57 +0100 Subject: [PATCH] Sort habits by already done and slot --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 9345001..dfff2d7 100644 --- a/app.py +++ b/app.py @@ -155,7 +155,9 @@ def index(): else: habit.checked = False - # habits = [("lesen", "eine Seite vor dem Schlafen gehen"), ("sport", "3x Gym")] + # Sort habits by whether they have been checked today and then by slot + habits.sort(key=lambda habit: (habit.checked, habit.slot)) + return render_template( 'index.html', title=name,