Add a weekly cadence to the match schedule #15
1 changed files with 4 additions and 1 deletions
|
@ -340,7 +340,10 @@ class _State():
|
||||||
|
|
||||||
for channel, tasks in self._tasks.items():
|
for channel, tasks in self._tasks.items():
|
||||||
for match in tasks.get(_Key.MATCH_TASKS, []):
|
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])
|
yield (channel, match[_Key.MEMBERS_MIN])
|
||||||
|
|
||||||
def get_channel_match_tasks(self, channel_id: str) -> Generator[int, int, int]:
|
def get_channel_match_tasks(self, channel_id: str) -> Generator[int, int, int]:
|
||||||
|
|
Loading…
Add table
Reference in a new issue