importers.nbpy2017: Refactor out _strpdate method.
This commit is contained in:
parent
8da3fd4bd3
commit
c98f0d9ff3
1 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,6 @@ 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'
|
||||
CURRENCY = 'USD'
|
||||
|
||||
@classmethod
|
||||
|
@ -57,6 +56,10 @@ class Invoice2017:
|
|||
# Raise an AttributeError if we didn't read any invoice activity.
|
||||
self.actions
|
||||
|
||||
def _strpdate(self, s):
|
||||
date_s = util.rejoin_slice_words(s, slice(2), ',', 2)
|
||||
return util.strpdate(date_s, '%b. %d, %Y')
|
||||
|
||||
def _read_invoice_header(self, table, first_row_text, rows_text):
|
||||
self.invoice_id = first_row_text[1]
|
||||
recipient_h = table.find('th', text='Recipient')
|
||||
|
@ -91,9 +94,7 @@ class Invoice2017:
|
|||
else:
|
||||
# Refund handling could go here, if we need it.
|
||||
continue
|
||||
# Trim extraneous text like the time/a.m./p.m.
|
||||
date_str = util.rejoin_slice_words(timestamp, slice(2), ',', 2)
|
||||
action['date'] = util.strpdate(date_str, self.DATE_FMT)
|
||||
action['date'] = self._strpdate(timestamp)
|
||||
action['stripe_id'] = last_stripe_id
|
||||
self.actions.append(action)
|
||||
|
||||
|
|
Loading…
Reference in a new issue