From d002c93c6306e29e84ff1bf9643f70e5dc45105b Mon Sep 17 00:00:00 2001 From: Martin Morlot Date: Tue, 25 Jun 2019 10:44:03 +0200 Subject: [PATCH] [bp] Ignore invalid loans Certain loans are invalid as thus conditions were added for them to be valid. Closes: 42885@sibi, 12073@zendesk, 42778@sibi, 12114@zendesk, 12088@zendesk, 12061@zendesk --- modules/bp/pages/accountlist.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/bp/pages/accountlist.py b/modules/bp/pages/accountlist.py index 1c8e3025e3..c440d779d0 100644 --- a/modules/bp/pages/accountlist.py +++ b/modules/bp/pages/accountlist.py @@ -51,7 +51,11 @@ class item_account_generic(ItemElement): def condition(self): # For some loans the following xpath is absent and we don't want to skip them - return len(self.el.xpath('.//span[@class="number"]')) > 0 or Field('type')(self) == Account.TYPE_LOAN + # Also a case of loan that is empty and has no information exists and will be ignored + return (len(self.el.xpath('.//span[@class="number"]')) > 0 or + (Field('type')(self) == Account.TYPE_LOAN and + (len(self.el.xpath('.//div//*[contains(text(),"pas la restitution de ces données.")]')) == 0 and + len(self.el.xpath('.//div[@class="amount"]/span[contains(text(), "Contrat résilié")]')) == 0))) obj_id = CleanText('.//abbr/following-sibling::text()') obj_currency = Currency('.//span[@class="number"]') -- GitLab