Changeset - c98f0d9ff371
[Not reviewed]
0 1 0
Brett Smith - 6 years ago 2017-12-18 15:14:13
brettcsmith@brettcsmith.org
importers.nbpy2017: Refactor out _strpdate method.
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
import2ledger/importers/nbpy2017.py
Show inline comments
...
 
@@ -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)
 

	
0 comments (0 inline, 0 general)