Show most recent readings first

This commit is contained in:
Peter Stockings
2024-12-24 11:21:05 +11:00
parent 5f61e1967b
commit 9b137f21fa

View File

@@ -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()