From 1164e1e66cd0b8f3a84390ee0d57582c17e62dfb Mon Sep 17 00:00:00 2001 From: Brad Brown Date: Fri, 3 Jun 2022 08:19:18 -0500 Subject: [PATCH] Better today calculation, corrected schedule --- .github/workflows/last-pull.yml | 2 +- .github/workflows/update.yml | 2 +- wordlinator/utils.py | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/last-pull.yml b/.github/workflows/last-pull.yml index 445fd9e..ea2ecd4 100644 --- a/.github/workflows/last-pull.yml +++ b/.github/workflows/last-pull.yml @@ -2,7 +2,7 @@ name: Last Pull for Yesterday on: workflow_dispatch: schedule: - - cron: '0 2 * * *' + - cron: '0 10 * * *' env: TWITTER_TOKEN: ${{ secrets.TWITTER_TOKEN }} TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 37fd269..800fdd3 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -2,7 +2,7 @@ name: Update Scores on: workflow_dispatch: schedule: - - cron: '0 4,8,10,16,18 * * *' + - cron: '0 15,19,20,1,4 * * *' env: TWITTER_TOKEN: ${{ secrets.TWITTER_TOKEN }} TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} diff --git a/wordlinator/utils.py b/wordlinator/utils.py index c7706f8..04d1bd9 100644 --- a/wordlinator/utils.py +++ b/wordlinator/utils.py @@ -44,4 +44,11 @@ class WordleDay: return self.wordle_no == other.wordle_no -WORDLE_TODAY = WordleDay.from_date(datetime.date.today()) +# Designed so that "today" will be the current date in CST +# Regardless of where the code is run +today = ( + datetime.datetime.now(datetime.timezone.utc) + .astimezone(datetime.timezone(datetime.timedelta(hours=-5), name="US Central")) + .date() +) +WORDLE_TODAY = WordleDay.from_date(today)