Modify sparkline so it ranges from earliest workout date to current date
This commit is contained in:
4
app.py
4
app.py
@@ -632,7 +632,7 @@ def generate_calendar_monthly_view(workouts, selected_date):
|
|||||||
start_date, end_date = get_month_bounds(selected_date)
|
start_date, end_date = get_month_bounds(selected_date)
|
||||||
|
|
||||||
# Build a lookup dictionary for faster access
|
# 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()
|
current_date = datetime.now().date()
|
||||||
days_of_month = [
|
days_of_month = [
|
||||||
@@ -674,7 +674,7 @@ def generate_daily_duration_sparkline(workouts):
|
|||||||
|
|
||||||
# Determine date range based on workouts data
|
# Determine date range based on workouts data
|
||||||
start_date = workouts[-1]['start_time_date']
|
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
|
# Build a mapping of dates to their respective durations for easier lookup
|
||||||
workouts_by_date = {w['start_time_date']: int(
|
workouts_by_date = {w['start_time_date']: int(
|
||||||
|
|||||||
Reference in New Issue
Block a user