fix parsing of amounts
This commit is contained in:
parent
cfd1603a4b
commit
d67b6449d1
3 changed files with 5 additions and 5 deletions
|
|
@ -57,7 +57,7 @@ class AccountComing(BasePage):
|
|||
if m:
|
||||
label = text % m.groupdict()
|
||||
|
||||
amount = tds[2].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n')
|
||||
amount = tds[2].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n\r')
|
||||
|
||||
operation = Operation(len(self.operations))
|
||||
operation.date = d
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class AccountHistory(BasePage):
|
|||
if ' ' in op.label:
|
||||
op.category, useless, op.label = [part.strip() for part in op.label.partition(' ')]
|
||||
|
||||
debit = tr.xpath('.//td[@class="debit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n')
|
||||
credit = tr.xpath('.//td[@class="credit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n')
|
||||
debit = tr.xpath('.//td[@class="debit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n\r')
|
||||
credit = tr.xpath('.//td[@class="credit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n\r')
|
||||
if len(debit) > 0:
|
||||
op.amount = - float(debit)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class AccountsList(BasePage):
|
|||
account.label = tr.xpath('.//td[@class="libelleCompte"]/a')[0].text.strip()
|
||||
|
||||
tds = tr.findall('td')
|
||||
account.balance = float(tds[3].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n'))
|
||||
account.balance = float(tds[3].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n\r'))
|
||||
if tds[4].find('a') is not None:
|
||||
account.coming = float(tds[4].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n'))
|
||||
account.coming = float(tds[4].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0€\n\r'))
|
||||
l.append(account)
|
||||
|
||||
if len(l) == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue