handling duplicate account id (closes #2114)
This commit is contained in:
parent
5572970f5c
commit
a9957967b5
1 changed files with 10 additions and 1 deletions
|
|
@ -69,9 +69,10 @@ class AccountsPage(LoggedPage, HTMLPage):
|
|||
|
||||
class Type(Filter):
|
||||
def filter(self, label):
|
||||
if 'invest' in label.lower():
|
||||
return Account.TYPE_MARKET
|
||||
return Account.TYPE_UNKNOWN
|
||||
|
||||
obj_id = CleanText('./td[2]', replace=[('.', ''), (' ', '')])
|
||||
obj_label = Label(CleanText('./td[1]/a'))
|
||||
obj_coming = Env('coming')
|
||||
obj_balance = CleanDecimal('./td[3]', replace_dots=True)
|
||||
|
|
@ -80,6 +81,14 @@ class AccountsPage(LoggedPage, HTMLPage):
|
|||
obj_type = Type(Field('label'))
|
||||
obj_coming = NotAvailable
|
||||
|
||||
@property
|
||||
def obj_id(self):
|
||||
# Investment account and main account can have the same id
|
||||
# so we had account type in case of Investment to prevent conflict
|
||||
if Field('type')(self) == Account.TYPE_MARKET:
|
||||
return CleanText(replace=[('.', ''), (' ', '')]).filter(self.el.xpath('./td[2]')) + ".INVEST"
|
||||
return CleanText(replace=[('.', ''), (' ', '')]).filter(self.el.xpath('./td[2]'))
|
||||
|
||||
|
||||
class Pagination(object):
|
||||
def next_page(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue