From 1b78055d7dc63b9675f37be26908208602937af9 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Tue, 20 Nov 2018 21:11:25 -0500 Subject: [PATCH] Made Non-assigned waitons handle properly --- house_management.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/house_management.py b/house_management.py index a352ec1..90bef39 100644 --- a/house_management.py +++ b/house_management.py @@ -23,6 +23,7 @@ SIGNOFF_VAL = 0.1 # What to put for a non-signed-off job SIGNOFF_PLACEHOLDER = "E-SIGNOFF" +NOT_ASSIGNED = "N/A" @dataclass @@ -56,7 +57,8 @@ class JobAssignment(object): signer_name = self.signer.name if self.signer is not None else SIGNOFF_PLACEHOLDER late = "y" if self.late else "n" bonus = "y" if self.bonus else "n" - return self.job.name, self.job.house, self.job.day_of_week, self.assignee.name, signer_name, late, bonus + assignee = self.assignee.name if self.assignee else NOT_ASSIGNED + return self.job.name, self.job.house, self.job.day_of_week, assignee, signer_name, late, bonus @dataclass @@ -152,7 +154,7 @@ async def import_assignments() -> List[Optional[JobAssignment]]: # Now make an assignment for the job # Find the brother it is assigned to - if assignee is not None and assignee != "" and assignee != "N/A": + if assignee is not None and assignee != "" and assignee != NOT_ASSIGNED: try: assignee = await scroll_util.find_by_name(assignee, SHEET_LOOKUP_THRESHOLD) except scroll_util.BrotherNotFound: