From 2eacb46353f9a08691a957ce276c82803a904789 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 17 May 2020 21:32:07 -0400 Subject: [PATCH] doorUpdater: Add "Staffed Hours Only" limited operations role Also fix new name for old "access permitted during limited operations" role, which now allows for access during limited operations using the member's normal access hours --- memberPlumbing/doorUpdater.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/memberPlumbing/doorUpdater.py b/memberPlumbing/doorUpdater.py index 87113f3..d21d417 100755 --- a/memberPlumbing/doorUpdater.py +++ b/memberPlumbing/doorUpdater.py @@ -74,7 +74,13 @@ class MembershipworksMember(Member): self.onHold = data["Account on Hold"] != "" self.limitedOperations = ( - data["Access Permitted During Limited Operations"] == "Y" + data[ + "Access Permitted Using Membership Level Schedule During COVID-19 Limited Operations" + ] + == "Y" + ) + self.staffedLimitedOperations = ( + data["Access Permitted During COVID-19 Staffed Period Only"] == "Y" ) self.formerMember = formerMember @@ -98,15 +104,15 @@ class MembershipworksMember(Member): def to_DoorMember(self, door): doorLevels = [k for k, v in self.extraLevels.items() if door.name in v] - if ( - door.name not in self.doorAccess - or self.onHold - or self.formerMember - or not self.limitedOperations - ): - schedules = [] - else: - schedules = self.schedules + doorLevels + schedules = [] + if door.name in self.doorAccess and not self.onHold and not self.formerMember: + # members should get their normal schedules + if self.limitedOperations: + schedules = self.schedules + doorLevels + + # members should get only the staffed hours schedule + if self.staffedLimitedOperations: + schedules += ["Staffed Hours"] dm = DoorMember( door, @@ -336,7 +342,7 @@ def main(): config = Config() membershipworks = config.membershipworks membershipworks_attributes = ( - "_id,nam,phn,eml,lvl,lbl,xws,xms,xsc,xas,xfd,xac,xcf,xeh,xse,xlo" + "_id,nam,phn,eml,lvl,lbl,xws,xms,xsc,xas,xfd,xac,xcf,xeh,xse,xlo,xxc" ) memberData = membershipworks.get_members(