Commit 3ae6073c authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[aviva] Fetch all investments and handle new case for opening_date

Some invests were missing because we only fetched the first `<div>` table.
This works well with aviva but for the abstract module "afer" we must
filter the `<tr>` from the "Répartition" table by counting their `<td>`.
Also handled another xpath for opening_date.
parent e3573f52
......@@ -87,6 +87,7 @@ class InvestmentPage(LoggedPage, HTMLPage):
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 @@ class InvestmentPage(LoggedPage, HTMLPage):
@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
......
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