diff --git a/app/routes.py b/app/routes.py index 6416cab..ccd4496 100644 --- a/app/routes.py +++ b/app/routes.py @@ -66,13 +66,23 @@ def dashboard(): badges.append("100 Readings Milestone") if len(weekly_readings) >= 7: badges.append("Logged Readings for 7 Days") + + # Prepare data for the graphs + timestamps = [reading.timestamp.strftime('%b %d') for reading in readings] + systolic = [reading.systolic for reading in readings] + diastolic = [reading.diastolic for reading in readings] + heart_rate = [reading.heart_rate for reading in readings] # Pass the delete form to the template delete_form = DeleteForm() return render_template('dashboard.html', readings=readings, profile=profile, badges=badges, systolic_avg=systolic_avg, diastolic_avg=diastolic_avg, heart_rate_avg=heart_rate_avg, - delete_form=delete_form) + delete_form=delete_form, + timestamps=timestamps, + systolic=systolic, + diastolic=diastolic, + heart_rate=heart_rate) @main.route('/dashboard/filter', methods=['POST']) @login_required diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index b29bd45..66d672e 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -42,11 +42,99 @@ + +