Skip to content

Commit

Permalink
Properly reset week at 9pm EST on friday
Browse files Browse the repository at this point in the history
  • Loading branch information
tesence committed Jan 6, 2025
1 parent 7f2edc3 commit 53a99b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gumo/modules/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ def get_current_week_start_date():
Returns:
date: Friday of the current week
"""
return get_week_start_date(datetime.now(EASTERN_TZ))
return get_week_start_date(datetime.now(EASTERN_TZ) - timedelta(hours=21))

def get_week_start_date(date):
"""Return the date when the given league week started (previous friday)
Returns:
date: Friday of the current week
"""
now = date - timedelta(hours=21)
last_friday = now - timedelta(days=(now.weekday() - 4 + 7) % 7)
last_friday = date - timedelta(days=(date.weekday() - 4 + 7) % 7)
return last_friday.strftime('%Y-%m-%d')

async def _wrap_query(method, query, *params):
Expand Down

0 comments on commit 53a99b6

Please sign in to comment.