From 88fc1ef5732f3f8694088577717c80e4ee556639 Mon Sep 17 00:00:00 2001 From: Verox Date: Mon, 11 Mar 2024 19:07:50 +0100 Subject: [PATCH] Added habit list being fixed at one after page reload --- app.py | 9 ++++++++- templates/components/habit_lists.html | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 39393fd..aae3ec7 100644 --- a/app.py +++ b/app.py @@ -73,6 +73,12 @@ def index(): for habit in habit_list.get_habits(): habit.load_statistics() + # Get active_list from query parameter + try: + active_list = int(request.args.get('list')) + except (ValueError, TypeError): + active_list = None + return render_template( 'index.html', title=name, @@ -80,7 +86,8 @@ def index(): heatmap_values=heatmap_values, day=day, color=heatmap_color, - errors={} + errors={}, + active_list=active_list ) diff --git a/templates/components/habit_lists.html b/templates/components/habit_lists.html index 0c7c12b..0b377bd 100644 --- a/templates/components/habit_lists.html +++ b/templates/components/habit_lists.html @@ -12,7 +12,7 @@ {% for habit_list in habit_lists %}