Fix history of accounts
This commit is contained in:
parent
805ec01764
commit
e1190dea23
1 changed files with 5 additions and 5 deletions
|
|
@ -85,9 +85,9 @@ class AccountsList(BasePage):
|
||||||
|
|
||||||
def get_transactions(self, index):
|
def get_transactions(self, index):
|
||||||
i = 0
|
i = 0
|
||||||
for table in self.document.xpath('//table[@cellpadding="0"]'):
|
for table in self.document.xpath('//table'):
|
||||||
try:
|
try:
|
||||||
textdate = table.find('.//td[@class="elmt tdate"]').text_content()
|
textdate = table.find('.//td[@class="date"]').text_content()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
# Do not parse transactions already parsed
|
# Do not parse transactions already parsed
|
||||||
|
|
@ -104,16 +104,16 @@ class AccountsList(BasePage):
|
||||||
textdate = textdate.replace(' ', '')
|
textdate = textdate.replace(' ', '')
|
||||||
textdate = textdate.replace(frenchmonth, '/%s/' %month)
|
textdate = textdate.replace(frenchmonth, '/%s/' %month)
|
||||||
# We use lower for compatibility with old website
|
# We use lower for compatibility with old website
|
||||||
textraw = table.find('.//td[@class="elmt lbl"]').text_content().strip().lower()
|
textraw = table.find('.//td[@class="lbl"]').text_content().strip().lower()
|
||||||
# The id will be rewrite
|
# The id will be rewrite
|
||||||
op = Transaction(1)
|
op = Transaction(1)
|
||||||
amount = op.clean_amount(table.xpath('.//td[starts-with(@class, "elmt amount")]')[0].text_content())
|
amount = op.clean_amount(table.xpath('.//td[starts-with(@class, "amount")]')[0].text_content())
|
||||||
id = hashlib.md5(textdate.encode('utf-8') + textraw.encode('utf-8')
|
id = hashlib.md5(textdate.encode('utf-8') + textraw.encode('utf-8')
|
||||||
+ amount.encode('utf-8')).hexdigest()
|
+ amount.encode('utf-8')).hexdigest()
|
||||||
op.id = id
|
op.id = id
|
||||||
op.parse(date = date(*reversed([int(x) for x in textdate.split('/')])),
|
op.parse(date = date(*reversed([int(x) for x in textdate.split('/')])),
|
||||||
raw = textraw)
|
raw = textraw)
|
||||||
category = table.find('.//td[@class="elmt picto"]/span')
|
category = table.find('.//td[@class="picto"]/span')
|
||||||
category = unicode(category.attrib['class'].split('-')[0].lower())
|
category = unicode(category.attrib['class'].split('-')[0].lower())
|
||||||
try:
|
try:
|
||||||
op.category = self.catvalue[category]
|
op.category = self.catvalue[category]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue