Nettoyage des restes de paiement par année scolaire

Ça fait plus d'un an qu'on est passés aux factures avec
 generalizedTimeFormat
This commit is contained in:
Pierre-Elliott Bécue 2015-11-26 19:27:29 +01:00
parent af0e971764
commit baf79bdda7
13 changed files with 498 additions and 220 deletions

View file

@ -35,8 +35,6 @@ import gestion.config as config
import gestion.affichage as affichage
from cranslib.decorators import static_var
from config import ann_scol
### Appels à LDAP et tri initial sur l'année en cours.
DB = shortcuts.lc_ldap_readonly()
@ -91,7 +89,7 @@ def actions_cableurs():
champ = parse_historique(histo_line)[0]
champ_action = parse_historique(histo_line)[1]
date = parse_historique(histo_line)[2]
if (u' inscription' in champ_action or u'Adhesion+' in champ_action) and date > datetime.date(ann_scol, 8, 1):
if (u' inscription' in champ_action or u'Adhesion+' in champ_action) and date > datetime.date(config.ann_scol, 8, 1):
HISTORIQUE.append(champ)
for facture in factures():
@ -100,7 +98,7 @@ def actions_cableurs():
champ = parse_historique(histo_line)[0]
champ_action = parse_historique(histo_line)[1]
date = parse_historique(histo_line)[2]
if u'controle' in champ_action and date > datetime.date(ann_scol, 8, 1):
if u'controle' in champ_action and date > datetime.date(config.ann_scol, 8, 1):
HISTORIQUE.append(champ)
return HISTORIQUE
@ -113,7 +111,7 @@ def score_cableurs():
nom = cableur.get(u'nom', None)[0].value
prenom = cableur.get(u'prenom', None)[0].value
uid = cableur.get(u'uid', None)[0].value
for index in range (0, len(HISTORIQUE)):
for index in range(0, len(HISTORIQUE)):
histo_uid = HISTORIQUE[index][2]
histo_action = HISTORIQUE[index][3]
if histo_uid == uid and histo_action == u' inscription':
@ -129,17 +127,17 @@ def score_cableurs():
### Tri par score
def sort_by_score():
"""Tri la liste des câbleurs par ordre de score décroissant de score"""
return score_cableurs().sort(key=lambda x:int(x[1]), reverse=True)
return score_cableurs().sort(key=lambda x: int(x[1]), reverse=True)
def sort_by_inverse_score():
"""Tri la liste des câbleurs par ordre de score croissant de score"""
return score_cableurs().sort(key=lambda x:int(x[1]))
return score_cableurs().sort(key=lambda x: int(x[1]))
def cableurs_utiles():
"""Renvoi le nombre de cableurs ayant un score non nul"""
useless_cableurs = 0
for k in range(0, len(cableurs())):
if (SCORES[k][1] == 0):
if SCORES[k][1] == 0:
useless_cableurs = useless_cableurs + 1
return len(cableurs()) - useless_cableurs