Merge pull request #1082 from tcely/patch-4
Some checks are pending
CI / info (push) Waiting to run
CI / test (3.10) (push) Waiting to run
CI / test (3.11) (push) Waiting to run
CI / test (3.12) (push) Waiting to run
CI / test (3.13) (push) Waiting to run
CI / containerise (push) Blocked by required conditions

Use `datetime.weekday()` function
This commit is contained in:
meeb 2025-05-31 17:34:49 +10:00 committed by GitHub
commit 5a8ac8187c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -393,7 +393,7 @@ class Source(db.models.Model):
return arg_dt + timezone.timedelta(hours=delta_hours)
def advance_day(arg_dt, target_weekday, /):
delta_days = ((7 + target_weekday) - arg_dt.weekday) % 7
delta_days = ((7 + target_weekday) - arg_dt.weekday()) % 7
return arg_dt + timezone.timedelta(days=delta_days)
if self.target_schedule is None:
@ -412,7 +412,7 @@ class Source(db.models.Model):
return self.target_schedule
when = advance_hour(when, self.target_schedule.hour)
when = advance_day(when, self.target_schedule.weekday)
when = advance_day(when, self.target_schedule.weekday())
self.target_schedule = when
return when