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

[creditmutuel/cic] Remove trash from Transactions labels

The infamous "Cliquer pour déplier ou plier le détail de l’opération" is
back!

This is linked to the commit 6d41bfaf that removes this piece of some
transaction labels ; but it turns out that now it's not located in
parts[0] instead of parts[1].
I first remove all empty strings and then look for the string that we
want to get rid of ; if it's there I remove it from the list, this way
it is more dynamic that parts[0] or parts[1].

Tested with CIC and creditmutuel connections.

Closes: 6378@zendesk, 6382@zendesk, 6381@zendesk, 6398@zendesk
parent 294283b8
......@@ -645,11 +645,14 @@ class OperationsPage(LoggedPage, HTMLPage):
# hideifscript: Date de valeur XX/XX/XXXX
# fd: Avis d'opéré
# survey to add other regx
parts = [re.sub('Détail|Date de valeur\s+:\s+\d{2}/\d{2}(/\d{4})?', '', txt.strip()) for txt in el.itertext() if len(txt.strip()) > 0]
parts = (re.sub('Détail|Date de valeur\s+:\s+\d{2}/\d{2}(/\d{4})?', '', txt.strip()) for txt in el.itertext() if len(txt.strip()) > 0)
# Removing empty strings:
parts = [s for s in parts if s]
# To simplify categorization of CB, reverse order of parts to separate
# location and institution.
if parts[0] == u"Cliquer pour déplier ou plier le détail de l'opération":
parts.pop(0)
detail = "Cliquer pour déplier ou plier le détail de l'opération"
if detail in parts:
parts.remove(detail)
if parts[0].startswith('PAIEMENT CB'):
parts.reverse()
......
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