Commit dafe3c7c authored by Stéphane Sobucki's avatar Stéphane Sobucki Committed by Vincent A

[boursorama] add condition to avoid an unnecessary request

Finding ownership for accounts only makes sense if there are ownerless
accounts.

I added a condition to make sure we are not sending the request to find
potential owners if there are no ownerless accounts.
parent 9a1f7111
......@@ -320,16 +320,17 @@ def do_login(self):
def ownership_guesser(self, accounts_list):
ownerless_accounts = [account for account in accounts_list if empty(account.ownership)]
# On Boursorama website, all mandatory accounts have the real owner name in their label, and
# children names are findable in the PSU profile.
self.profile_children.go()
children_names = self.page.get_children_firstnames()
for ownerless_account in ownerless_accounts:
for child_name in children_names:
if child_name in ownerless_account.label:
ownerless_account.ownership = AccountOwnership.ATTORNEY
break
if ownerless_accounts:
# On Boursorama website, all mandatory accounts have the real owner name in their label, and
# children names are findable in the PSU profile.
self.profile_children.go()
children_names = self.page.get_children_firstnames()
for ownerless_account in ownerless_accounts:
for child_name in children_names:
if child_name in ownerless_account.label:
ownerless_account.ownership = AccountOwnership.ATTORNEY
break
# If there are two deferred card for with the same parent account, we assume that's the parent checking
# account is a 'CO_OWNER' account
......
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