diff --git a/modules/cragr/regions/pages.py b/modules/cragr/regions/pages.py index c9891f8d78e6891345a386be4119c251a20e078b..f6aa30dd57fa8f37e3f72efbb3ca0d60453df1c6 100644 --- a/modules/cragr/regions/pages.py +++ b/modules/cragr/regions/pages.py @@ -490,8 +490,11 @@ def condition(self): def get_transactions_link(self, raw_number): # We cannot use Link() because the @href attribute contains line breaks and spaces. - # Always take the before the last to include the latest transactions - # (the last is just card information). + # Always take the before the last to include the latest transactions, + # except if there is only one line of coming (then take the last). + if len(self.doc.xpath('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr' % raw_number)) == 1: + return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()]/th/a/@href' + % raw_number, replace=[(' ', '')])(self.doc) return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()-1]/th/a/@href' % raw_number, replace=[(' ', '')])(self.doc)