Only yield matching tasks if the weekly cadence has been hit
This commit is contained in:
parent
e9cccefacb
commit
d83f933f1d
1 changed files with 4 additions and 1 deletions
|
@ -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]:
|
||||
|
|
Loading…
Add table
Reference in a new issue