From 44f27a4b6229e93a6db4dc8f1107d3cae35424ab Mon Sep 17 00:00:00 2001 From: Maxime Gasselin Date: Mon, 3 Dec 2018 10:50:48 +0100 Subject: [PATCH] [creditmutuel] Repair pro card return MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some cards were missing into the "activité cartes professionnelles" space. Moreover some invalid cards were return if we don't put it in the unavailable cards list. Closes: 8246@zendesk --- modules/creditmutuel/pages.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 673bf671fb..1b12b9e05c 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -613,8 +613,11 @@ def parse(self, el): page = page.browser.open(Link('//form//a[text()="Contrat"]', default=None)(page.doc)).page xpath = '//table[has-class("liste")]/tbody/tr' active_card = CleanText('%s[td[text()="Active"]][1]/td[2]' % xpath, replace=[(' ', '')], default=None)(page.doc) + for cards in page.doc.xpath(xpath): + if CleanText(cards.xpath('./td[1]'))(self) != 'Active': + self.page.browser.unavailablecards.append(CleanText(cards.xpath('./td[2]'), replace=[(' ', '')])(self)) - if not active_card or len(page.doc.xpath(xpath)) != 1: + if not active_card and len(page.doc.xpath(xpath)) != 1: raise SkipItem() self.env['id'] = active_card or CleanText('%s[1]/td[2]' % xpath, replace=[(' ', '')])(page.doc) -- GitLab