From 3ae6073c2ee689c02b91288c69f695ce0507e8cc Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Mon, 28 Dec 2020 18:51:20 +0100 Subject: [PATCH] [aviva] Fetch all investments and handle new case for opening_date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some invests were missing because we only fetched the first `
` table. This works well with aviva but for the abstract module "afer" we must filter the `` from the "Répartition" table by counting their ``. Also handled another xpath for opening_date. --- modules/aviva/pages/detail_pages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/aviva/pages/detail_pages.py b/modules/aviva/pages/detail_pages.py index b9e05de53f..f5c935ff23 100644 --- a/modules/aviva/pages/detail_pages.py +++ b/modules/aviva/pages/detail_pages.py @@ -87,6 +87,7 @@ class fill_account(ItemElement): obj_opening_date = Coalesce( Date(CleanText('''//h3[contains(text(), "Date d'effet de l'adhésion")]/following-sibling::p'''), dayfirst=True, default=NotAvailable), Date(CleanText('''//h3[contains(text(), "Date d’effet d’adhésion")]/following-sibling::p'''), dayfirst=True, default=NotAvailable), + Date(CleanText('''//h3[contains(text(), "Date d’effet fiscale")]/following-sibling::p'''), dayfirst=True, default=NotAvailable), default=NotAvailable ) @@ -106,7 +107,8 @@ def is_valuation_available(self): @method class iter_investment(ListElement): - item_xpath = '(//div[contains(@class, "m-table")])[1]//table/tbody/tr[not(contains(@class, "total"))]' + # Specify "count(td) > 3" to skip lines from the "Tableau de Répartition" (only contains percentages) + item_xpath = '//div[contains(@class, "m-table")]//table/tbody/tr[not(contains(@class, "total")) and count(td) > 3]' class item(ItemElement): klass = Investment -- GitLab