Only yield matching tasks if the weekly cadence has been hit
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 35s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 1m12s

This commit is contained in:
Marc Di Luzio 2024-09-22 12:20:55 +01:00
parent e9cccefacb
commit d83f933f1d

View file

@ -340,7 +340,10 @@ class _State():
for channel, tasks in self._tasks.items():
for match in tasks.get(_Key.MATCH_TASKS, []):
if match[_Key.WEEKDAY] == weekday and match[_Key.HOUR] == hour:
# Take into account the weekly cadence
start = ts_to_datetime(match[_Key.CADENCE_START])
weeks = int((time - start).days / 7)
if match[_Key.WEEKDAY] == weekday and match[_Key.HOUR] == hour and weeks % match[_Key.CADENCE] == 0:
yield (channel, match[_Key.MEMBERS_MIN])
def get_channel_match_tasks(self, channel_id: str) -> Generator[int, int, int]: