[ldap_crans] En rend un peu plus lisible le calcul de fin adh/conn

This commit is contained in:
Pierre-Elliott Bécue 2014-10-10 11:27:13 +02:00
parent 69efee5ce2
commit ddc6fb8a98
2 changed files with 13 additions and 2 deletions

View file

@ -1492,7 +1492,12 @@ class BaseProprietaire(BaseClasseCrans):
# On récupère sur les factures l'ensemble de celles comportant une adhésion.
adh_factures = self.factures_adh()
finAdh = max([0.0] + [fromGeneralizedTimeFormat(facture._data.get('finAdhesion', ["19700101000000Z"])[0]) for facture in adh_factures if facture.controle() != "FALSE" and facture.recuPaiement() is not None])
fgtf = lambda fac:fromGeneralizedTimeFormat(fac._data.get('finAdhesion', [config.gtfepoch])[0])
finAdh = max([0.0] + [fgtf(facture) for facture
in adh_factures
if facture.controle() != "FALSE"
and facture.recuPaiement() is not None
])
if update == False:
return finAdh
@ -2382,7 +2387,12 @@ class Adherent(BaseProprietaire):
# On récupère sur les factures l'ensemble de celles comportant une connexion.
conn_factures = self.factures_conn()
finConn = max([0.0] + [fromGeneralizedTimeFormat(facture._data.get('finConnexion', ["19700101000000Z"])[0]) for facture in conn_factures if facture.controle() != "FALSE" and facture.recuPaiement() is not None])
fgtf = lambda fac:fromGeneralizedTimeFormat(fac._data.get('finConnexion', [config.gtfepoch])[0])
finConn = max([0.0] + [fgtf(facture) for facture
in conn_factures
if facture.controle() != "FALSE"
and facture.recuPaiement() is not None
])
if mois is None:
return finConn