schedulebot: Don't set groups before the run starts

This is mainly a problem with groups_by_shift which will be set
even for negative hours that aren't on the schedule.

This causes notification spam as people move in and out of groups.
pull/353/head
Mike Lang 1 year ago
parent 5c7061efd2
commit 0164f9def8

@ -47,6 +47,10 @@ def get_display_name(client, user_id):
def update_groups(client, group_ids, groups_by_shift, schedule, hour, start_time, last): def update_groups(client, group_ids, groups_by_shift, schedule, hour, start_time, last):
if hour < 0:
logging.warning(f"Skipping setting groups due to negative hour of {hour}")
return
logging.info("Setting groups for hour {}".format(hour)) logging.info("Setting groups for hour {}".format(hour))
members = get_membership(client) members = get_membership(client)
_, shift, _, _ = hour_to_shift(hour, start_time) _, shift, _, _ = hour_to_shift(hour, start_time)

Loading…
Cancel
Save