schedulebot: Handle multiple rows for same user

pull/320/head
Mike Lang 2 years ago
parent 2fee3a6e9d
commit 93535b0af7

@ -189,6 +189,15 @@ def parse_schedule(user_ids, schedule_file):
logging.warning(f"No user id known for user {name}") logging.warning(f"No user id known for user {name}")
continue continue
user_id = user_ids[name] user_id = user_ids[name]
if user_id in schedule:
logging.warning(f"Multiple rows for user {name}, merging")
_, old_hours = schedule[user_id]
merged = [
old or new
for old, new in zip(old_hours, row[1:])
]
schedule[user_id] = name, merged
else:
schedule[user_id] = name, row[1:] schedule[user_id] = name, row[1:]
return schedule return schedule

Loading…
Cancel
Save