From 9b137f21fac3d3199cf6af78bb2b7ce526b621a4 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Tue, 24 Dec 2024 11:21:05 +1100 Subject: [PATCH] Show most recent readings first --- app/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routes.py b/app/routes.py index 0bf1d8d..6416cab 100644 --- a/app/routes.py +++ b/app/routes.py @@ -49,7 +49,7 @@ def dashboard(): profile = current_user.profile # Get all readings for the user - readings = Reading.query.filter_by(user_id=current_user.id).order_by(Reading.timestamp.desc()).all() + readings = Reading.query.filter_by(user_id=current_user.id).order_by(Reading.timestamp.asc()).all() # Weekly summary (last 7 days) one_week_ago = datetime.now() - timedelta(days=7) @@ -86,7 +86,7 @@ def filter_dashboard(): Reading.user_id == current_user.id, Reading.timestamp >= datetime.strptime(start_date, '%Y-%m-%d'), Reading.timestamp <= datetime.strptime(end_date, '%Y-%m-%d') - ).order_by(Reading.timestamp.desc()).all() + ).order_by(Reading.timestamp.asc()).all() # Pass the delete form to the template delete_form = DeleteForm()