diff --git a/matchy/state.py b/matchy/state.py index 66cb1a2..56fbb1d 100644 --- a/matchy/state.py +++ b/matchy/state.py @@ -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]: