From 7bb5815b08bccf02aece4473f67b8d07bfdd9fd8 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 28 Sep 2018 08:45:44 -0400 Subject: [PATCH] nbpy2017: Handle complimentary t-shirts. --- import2ledger/importers/nbpy2017.py | 6 ++++-- tests/data/nbpy2017c.html | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/import2ledger/importers/nbpy2017.py b/import2ledger/importers/nbpy2017.py index 71686f4..f861d2f 100644 --- a/import2ledger/importers/nbpy2017.py +++ b/import2ledger/importers/nbpy2017.py @@ -89,10 +89,12 @@ class Invoice2017: if description.startswith('Ticket - '): if total > 0: self.tickets_sold += int(qty) - elif description.startswith('T-Shirt - '): - self.shirts_sold += int(qty) elif description.startswith('Early Bird ('): self.ticket_rate = self.DISCOUNT_TICKET_RBI + elif description.startswith('T-Shirt - '): + self.shirts_sold += int(qty) + elif description.startswith('T-shirts complimentary '): + self.shirts_sold -= int(qty) def _read_invoice_activity(self, table, first_row_text, rows_text): self.actions = [{ diff --git a/tests/data/nbpy2017c.html b/tests/data/nbpy2017c.html index 1c9446b..4c54102 100644 --- a/tests/data/nbpy2017c.html +++ b/tests/data/nbpy2017c.html @@ -179,9 +179,9 @@ T-Shirt - Men's/Straight Cut Size M - 2 + 3 $30.00 - $60.00 + $90.00 Tutorials - Notify me when tutorials are open @@ -189,6 +189,12 @@ $-0.00 $-0.00 + + T-shirts complimentary for staff and volunteers (T-Shirt - Men's/Straight Cut Size M) + 1 + $-30.00 + $-30.00 + TOTAL $60.00