diff --git a/import2ledger/importers/nbpy2017.py b/import2ledger/importers/nbpy2017.py index 993c8b962ce959418583681c7ca0a26d1be255d0..660189d1ccbfcf77c26386496f4030afbe5a4392 100644 --- a/import2ledger/importers/nbpy2017.py +++ b/import2ledger/importers/nbpy2017.py @@ -9,7 +9,7 @@ class Invoice2017: DISCOUNT_TICKET_RATE = STANDARD_TICKET_RATE / 2 STANDARD_SHIRT_RATE = decimal.Decimal('25.50') DISCOUNT_SHIRT_RATE = STANDARD_SHIRT_RATE - DATE_FMT = '%b. %d, %Y,' + DATE_FMT = '%b. %d, %Y' CURRENCY = 'USD' @classmethod @@ -81,10 +81,9 @@ class Invoice2017: def _read_invoice_activity(self, table, first_row_text, rows_text): self.actions = [] - date_wordcount = self.DATE_FMT.count(' ') + 1 for timestamp, description, amount in rows_text: if description.startswith('Paid '): - last_stripe_id = description.rsplit(None, 1)[1] + last_stripe_id = util.rslice_words(description, 1, limit=1) action = { 'multiplier': 1, 'payment_id': last_stripe_id, @@ -93,8 +92,8 @@ class Invoice2017: # Refund handling could go here, if we need it. continue # Trim extraneous text like the time/a.m./p.m. - date_words = timestamp.split(' ', date_wordcount + 1)[:date_wordcount] - action['date'] = util.strpdate(' '.join(date_words), self.DATE_FMT) + date_str = util.rejoin_slice_words(timestamp, slice(2), ',', 2) + action['date'] = util.strpdate(date_str, self.DATE_FMT) action['stripe_id'] = last_stripe_id self.actions.append(action)