[controle_tresorier] tient compte de l'argument '-t' pour le contrôle interactif
darcs-hash:20101003175514-af139-94cace77b2b0978f746320f032465a0d06d6a691.gz
This commit is contained in:
parent
e8ed1887a2
commit
c0f64275a6
1 changed files with 26 additions and 21 deletions
|
@ -146,6 +146,23 @@ def _controle_interactif_clubs(liste):
|
|||
|
||||
return nb, len(liste)-nb
|
||||
|
||||
def qui(historique, quoi):
|
||||
"""
|
||||
Recherche le câbleur qui a effectué la dernière modification quoi
|
||||
dans l'historique, ou qui a inscrit l'adhérent.
|
||||
Retourne le couple (date, cableur) ou ('_inconnu_', '_inconnu_').
|
||||
"""
|
||||
regexp = re.compile(r'^([^,]*), ([^ :]*)')
|
||||
cableur = ('_inconnu_', '_inconnu_')
|
||||
|
||||
champ = re.compile(quoi)
|
||||
|
||||
for ligne in historique:
|
||||
if champ.search(ligne) or 'inscription' in ligne:
|
||||
matched = regexp.search(ligne)
|
||||
if matched: cableur = matched.group(1), matched.group(2)
|
||||
|
||||
return cableur
|
||||
|
||||
def controle_interactif(quoi):
|
||||
"""
|
||||
|
@ -156,8 +173,15 @@ def controle_interactif(quoi):
|
|||
% ({'p': 'paiement', 'c': 'carteEtudiant'}[quoi], ann_scol, quoi))
|
||||
|
||||
# Tri de la liste des adhérents selon nom, prénom
|
||||
# Ça peut se faire plus facilement en Python 2.4 avec l'argument key
|
||||
todo_list['adherent'].sort(lambda x, y: cmp((x.nom(), x.prenom()), (y.nom(), y.prenom())))
|
||||
todo_list['adherent'].sort(key = lambda x: (x.nom(), x.prenom()))
|
||||
|
||||
if trier_par == 'id':
|
||||
todo_list['adherent'].sort(key = lambda x: x.id())
|
||||
elif trier_par == 'nom':
|
||||
pass
|
||||
else:
|
||||
champ = { 'date': 0, 'cableur': 1 }[trier_par]
|
||||
todo_list['adherent'].sort(key = lambda x: qui(x.historique(), r'paiement')[champ])
|
||||
|
||||
# Traitement des adhérents
|
||||
oka, noka = _controle_interactif_adherents(todo_list['adherent'], quoi)
|
||||
|
@ -234,25 +258,6 @@ def formater_pour_bureau(dico):
|
|||
alignement = ['d', 'c', 'c', 'c']) + u'\nTotal : %d' % total
|
||||
|
||||
|
||||
def qui(historique, quoi):
|
||||
"""
|
||||
Recherche le câbleur qui a effectué la dernière modification quoi
|
||||
dans l'historique, ou qui a inscrit l'adhérent.
|
||||
Retourne le couple (date, cableur) ou ('_inconnu_', '_inconnu_').
|
||||
"""
|
||||
regexp = re.compile(r'^([^,]*), ([^ :]*)')
|
||||
cableur = ('_inconnu_', '_inconnu_')
|
||||
|
||||
champ = re.compile(quoi)
|
||||
|
||||
for ligne in historique:
|
||||
if champ.search(ligne) or 'inscription' in ligne:
|
||||
matched = regexp.search(ligne)
|
||||
if matched: cableur = matched.group(1), matched.group(2)
|
||||
|
||||
return cableur
|
||||
|
||||
|
||||
def chercher_cableurs(liste, quoi):
|
||||
"""
|
||||
Renvoie un dictionnaire cableur->adherents à partir de liste, quoi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue