From 3df228afd59c1fb4c6ad41ff4d7411b934e0f673 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 1 Jun 2018 13:59:43 -0400 Subject: [PATCH] doorUpdater: Allow people to have multiple schedules --- doorUpdater.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/doorUpdater.py b/doorUpdater.py index e508a17..0e8e15a 100755 --- a/doorUpdater.py +++ b/doorUpdater.py @@ -84,13 +84,11 @@ def makeMember(member, doorAuth): if member[doorAuth] == "Y" \ and not member["Account on Hold"] == "Account on Hold": - memberLevel = [(k, v) for k, v in memberLevels.items() if member[k] == k] - if len(memberLevel) == 1: - out["Custom1"] = memberLevel[0][0].replace("&", "and") - out["Schedule1"] = memberLevel[0][1] - else: - print(member["First Name"], member["Last Name"], - "has no/too many member levels!") + levels = {k: v for k, v in memberLevels.items() if member[k] == k} + out["Custom1"] = "|".join(levels.keys()).replace("&", "and") + for index, schedule in enumerate(levels.values(), 1): + #TODO: error if people have more than 8? + out["Schedule" + str(index)] = schedule return out