Commit bc9cecdc authored by James GALT's avatar James GALT Committed by Romain Bignon

removed transaction ids that might be non-unique

parent 93cce50e
......@@ -10,3 +10,5 @@ tags
docs/source/api
modules/modules.list
/localconfig
*.idea/
*.DS_Store
......@@ -291,7 +291,7 @@ class TransactionsPage(BasePage):
if len(tds) < 4:
continue
t = Transaction(0)
t = Transaction()
date = u''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = u''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()])
debit = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_DEBIT].itertext()]))
......@@ -317,7 +317,7 @@ class CBTransactionsPage(TransactionsPage):
if len(tds) < 3:
continue
t = Transaction(0)
t = Transaction()
date = u''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()]))
credit = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_CB_CREDIT].itertext()]))
......
......@@ -636,7 +636,7 @@ class TransactionsPage(BasePage):
else:
debit_date = account._prev_debit
if 'ContinueTask.do' in self.url:
t = Transaction(0)
t = Transaction()
t.parse(debit_date, 'RELEVE CARTE')
t.amount = -account._prev_balance
yield t
......@@ -647,7 +647,7 @@ class TransactionsPage(BasePage):
if len(tds) < 3:
continue
t = Transaction(i)
t = Transaction()
date = self.parser.tocleanstring(tds[self.COL_CARD_DATE])
label = self.parser.tocleanstring(tds[self.COL_CARD_LABEL])
......
......@@ -238,7 +238,7 @@ class CardPage(HistoryBasePage):
if len(tds) != 3:
continue
t = Transaction(0)
t = Transaction()
date = u''.join([txt.strip() for txt in tds[0].itertext()])
raw = u' '.join([txt.strip() for txt in tds[1].itertext()])
amount = u''.join([txt.strip() for txt in tds[-1].itertext()])
......
......@@ -246,7 +246,7 @@ class HistoryPage(BEPage):
tdamount = '- %s' % tddebit
else:
tdamount = tdcredit
t = Transaction(i)
t = Transaction()
t.set_amount(tdamount)
t.parse(tddate, tdlabel, tdval)
......
......@@ -316,7 +316,7 @@ class IndexPage(Page):
if len(detail) > 0:
detail[0].drop_tree()
t = Transaction(i)
t = Transaction()
date = u''.join([txt.strip() for txt in tds[i+0].itertext()])
raw = u' '.join([txt.strip() for txt in tds[i+1].itertext()])
......
......@@ -63,7 +63,7 @@ class TransactionsPage(Page):
def get_history(self):
for div in self.document.xpath('//ol[@class="affichMontant"]/li/div'):
t = Transaction(0)
t = Transaction()
raw = div.xpath('.//div[@class="row-lib"]')[0].text
date = div.xpath('.//span')[0].text.strip()
m = re.match('(\d+)(er)? ([^ ]+)( \d+)?$', date)
......
......@@ -294,7 +294,7 @@ class CardsPage(BasePage):
label = cols[1]
amount = cols[-1]
t = Transaction(i)
t = Transaction()
t.set_amount(amount)
t.label = t.raw = label
......@@ -432,7 +432,6 @@ class TransactionsPage(BasePage):
}
def get_history(self, date_guesser):
i = 0
for tr in self.document.xpath('//table[@class="ca-table"]//tr'):
parent = tr.getparent()
while parent is not None and parent.tag != 'table':
......@@ -461,7 +460,7 @@ class TransactionsPage(BasePage):
if tr.find('th') is not None or len(cols) < 3:
continue
t = Transaction(i)
t = Transaction()
col_text = cols[self.COL_TEXT]
if len(col_text.xpath('.//br')) == 0:
......@@ -509,7 +508,6 @@ class TransactionsPage(BasePage):
t.set_amount(credit, debit)
yield t
i += 1
class MarketPage(BasePage):
......
......@@ -114,7 +114,7 @@ class TransactionsJSONPage(LoggedPage, JsonPage):
def get_transactions(self):
seen = set()
for tr in self.doc['exportData'][1:]:
t = Transaction(0)
t = Transaction()
t.parse(tr[self.ROW_DATE], tr[self.ROW_TEXT])
t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT])
t.id = t.unique_id(seen)
......@@ -145,7 +145,7 @@ class ComingTransactionsPage(LoggedPage, HTMLPage):
break
for tr in data:
t = Transaction(0)
t = Transaction()
t.parse(tr[self.ROW_DATE], tr[self.ROW_TEXT])
t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT])
yield t
......@@ -131,7 +131,7 @@ class TransactionsPage(ITransactionsPage):
debit = get_content(tds[self.TR_DEBIT])
credit = get_content(tds[self.TR_CREDIT])
t = Transaction(date+""+raw)
t = Transaction()
t.parse(date, re.sub(r'[ ]+', ' ', raw))
t.set_amount(credit, debit)
......@@ -176,7 +176,7 @@ class CardTransactionsPage(ITransactionsPage):
else:
date += "/%d" % time.localtime().tm_year
t = Transaction(date+""+raw)
t = Transaction()
t.parse(date, re.sub(r'[ ]+', ' ', raw))
t.set_amount("", debit)
......
......@@ -492,7 +492,7 @@ class ProTransactionsPage(TransactionsPage):
def get_history(self):
for i, tr in self.parse_transactions():
t = Transaction(i)
t = Transaction()
date = tr['date']
raw = self.parser.strip('<p>%s</p>' % (' '.join([tr['typeope'], tr['LibComp']])))
t.parse(date, raw)
......
......@@ -223,7 +223,7 @@ class AccountHistory(BasePage):
if not t:
continue
t = Transaction(i)
t = Transaction()
if 'EnTraitement' in tr.get('class', ''):
t._coming = True
......
......@@ -209,7 +209,7 @@ class HistoryPage(SGPEPage):
tdamount = tddebit or tdcredit
# not sure it has empty rows like AccountsPage, but check anyway
if all((tddate, tdlabel, tdamount)):
t = Transaction(i)
t = Transaction()
t.set_amount(tdamount)
date = datetime.strptime(tddate, '%d/%m/%Y')
val = datetime.strptime(tdval, '%d/%m/%Y')
......@@ -248,7 +248,7 @@ class CardHistoryPage(SGPEPage):
if len(date) == 0:
continue
t = Transaction(i)
t = Transaction()
t.parse(date, raw)
t.set_amount(amount)
yield t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment