doorUpdater: Allow people to have multiple schedules

This commit is contained in:
Adam Goldsmith 2018-06-01 13:59:43 -04:00
parent e9ce04e3cd
commit 3df228afd5

View File

@ -84,13 +84,11 @@ def makeMember(member, doorAuth):
if member[doorAuth] == "Y" \ if member[doorAuth] == "Y" \
and not member["Account on Hold"] == "Account on Hold": and not member["Account on Hold"] == "Account on Hold":
memberLevel = [(k, v) for k, v in memberLevels.items() if member[k] == k] levels = {k: v for k, v in memberLevels.items() if member[k] == k}
if len(memberLevel) == 1: out["Custom1"] = "|".join(levels.keys()).replace("&", "and")
out["Custom1"] = memberLevel[0][0].replace("&", "and") for index, schedule in enumerate(levels.values(), 1):
out["Schedule1"] = memberLevel[0][1] #TODO: error if people have more than 8?
else: out["Schedule" + str(index)] = schedule
print(member["First Name"], member["Last Name"],
"has no/too many member levels!")
return out return out