Commit 4cc2b143 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[cragr/regions] Return no transaction if we cannot find the ongoing_coming

Some cards haven't been used for a while so we cannot fetch a date for
the ongoing coming ; in these cases we return no transaction for history
or coming other the Regexp() will crash.

Closes: 12355@zendesk
parent 63d76431
......@@ -530,6 +530,9 @@ class CragrRegion(LoginBrowser):
# we must skip the ongoing one but fetch the other ones
# even if they are in the future.
ongoing_coming = self.page.get_ongoing_coming()
if not ongoing_coming:
# This card has no available history or coming.
return
card_transactions = []
latest_date = None
......
......@@ -418,8 +418,10 @@ class CardsPage(LoggedPage, CragrPage):
# the coming is positive, it will become 'Opérations créditées'
raw_date = Regexp(
CleanText('//table[@class="ca-table"]//tr[1]//b[contains(text(), "Opérations débitées") or contains(text(), "Opérations créditées")]'),
r'le (.*) :'
r'le (.*) :', default=None
)(self.doc)
if not raw_date:
return None
return parse_french_date(raw_date).date()
def get_card_transactions(self, latest_date, ongoing_coming):
......
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