Modify sparkline so it ranges from earliest workout date to current date

This commit is contained in:
Peter Stockings
2023-10-21 22:48:25 +11:00
parent 32643a0ba8
commit a4f5897365

4
app.py
View File

@@ -632,7 +632,7 @@ def generate_calendar_monthly_view(workouts, selected_date):
start_date, end_date = get_month_bounds(selected_date)
# Build a lookup dictionary for faster access
workout_lookup = {w['start_time_date'] : w for w in workouts if start_date <= w['start_time_date'] <= end_date}
workout_lookup = {w['start_time_date']: w for w in workouts if start_date <= w['start_time_date'] <= end_date}
current_date = datetime.now().date()
days_of_month = [
@@ -674,7 +674,7 @@ def generate_daily_duration_sparkline(workouts):
# Determine date range based on workouts data
start_date = workouts[-1]['start_time_date']
end_date = workouts[0]['start_time_date']
end_date = datetime.now().date() # workouts[0]['start_time_date']
# Build a mapping of dates to their respective durations for easier lookup
workouts_by_date = {w['start_time_date']: int(