Skip to content

Commit

Permalink
hotfix again
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Feb 2, 2025
1 parent 0dae92c commit b1558b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/update_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ async def refresh_user_data(
:param dt: datetime injection, helpful for testing
:return: dict
"""
# when refresh triggered on sundays, we need to step into next week
dt_tomorrow = dt + datetime.timedelta(days=1)

strava_client = auth_manager.get_strava_client(user.athlete_id)
daily_activity = activities.get_daily_activity(
strava_client, dt=utils.get_last_sunday(dt), num_weeks=52
Expand All @@ -145,9 +148,8 @@ async def refresh_user_data(
dt=utils.get_last_sunday(dt),
)

# refresh user on sundays -> new week
mileage_recommendation_row = supabase_client.get_mileage_recommendation(
athlete_id=user.athlete_id, dt=dt + datetime.timedelta(days=1)
athlete_id=user.athlete_id, dt=dt_tomorrow
)
mileage_rec = MileageRecommendation(
thoughts=mileage_recommendation_row.thoughts,
Expand All @@ -162,7 +164,7 @@ async def refresh_user_data(
daily_activity=daily_activity,
mileage_rec=mileage_rec,
exe_type=ExeType.MID_WEEK,
dt=dt,
dt=dt_tomorrow,
)

supabase_client.upsert_training_week(
Expand Down

0 comments on commit b1558b6

Please sign in to comment.