Show most recent readings first
This commit is contained in:
@@ -49,7 +49,7 @@ def dashboard():
|
|||||||
profile = current_user.profile
|
profile = current_user.profile
|
||||||
|
|
||||||
# Get all readings for the user
|
# 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)
|
# Weekly summary (last 7 days)
|
||||||
one_week_ago = datetime.now() - timedelta(days=7)
|
one_week_ago = datetime.now() - timedelta(days=7)
|
||||||
@@ -86,7 +86,7 @@ def filter_dashboard():
|
|||||||
Reading.user_id == current_user.id,
|
Reading.user_id == current_user.id,
|
||||||
Reading.timestamp >= datetime.strptime(start_date, '%Y-%m-%d'),
|
Reading.timestamp >= datetime.strptime(start_date, '%Y-%m-%d'),
|
||||||
Reading.timestamp <= datetime.strptime(end_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
|
# Pass the delete form to the template
|
||||||
delete_form = DeleteForm()
|
delete_form = DeleteForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user