Add graphs on dashboard
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user