fin_connexion: docstrings supp
This commit is contained in:
parent
c011293227
commit
5501a15cbf
1 changed files with 6 additions and 1 deletions
|
@ -57,6 +57,8 @@ FILTRE_TPL = u"""(&
|
||||||
|
|
||||||
|
|
||||||
def warn(mail_conn, adh):
|
def warn(mail_conn, adh):
|
||||||
|
"""Envoie un mail d'avertissement à ``adh``, en utilisant la connexion mail
|
||||||
|
``mail_conn``"""
|
||||||
fin = min(max(parse_gtf(v.value) for v in adh[l]) \
|
fin = min(max(parse_gtf(v.value) for v in adh[l]) \
|
||||||
for l in ['finConnexion', 'finAdhesion'] )
|
for l in ['finConnexion', 'finAdhesion'] )
|
||||||
delai = (fin - datetime.datetime.now(pytz.UTC)).days
|
delai = (fin - datetime.datetime.now(pytz.UTC)).days
|
||||||
|
@ -79,6 +81,7 @@ def warn(mail_conn, adh):
|
||||||
|
|
||||||
|
|
||||||
def compute_fin_connexion(adh):
|
def compute_fin_connexion(adh):
|
||||||
|
"""Renvoie le datetime de fin effective de connexion de l'``adh``"""
|
||||||
return min( max(parse_gtf(v.value) for v in adh['fin' + l])
|
return min( max(parse_gtf(v.value) for v in adh['fin' + l])
|
||||||
for l in ['Adhesion', 'Connexion'])
|
for l in ['Adhesion', 'Connexion'])
|
||||||
|
|
||||||
|
@ -101,6 +104,8 @@ def select(conn, begin, to, mode='r'):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def brief(c, debut, fin):
|
def brief(c, debut, fin):
|
||||||
|
"""Renvoie la liste des adhérents dont la connexion expire entre
|
||||||
|
debut et fin"""
|
||||||
if not debut.tzinfo:
|
if not debut.tzinfo:
|
||||||
debut = debut.replace(tzinfo=pytz.UTC)
|
debut = debut.replace(tzinfo=pytz.UTC)
|
||||||
if not fin.tzinfo:
|
if not fin.tzinfo:
|
||||||
|
@ -129,7 +134,7 @@ def prev_calendar(c, date):
|
||||||
last = first.replace(month=1+month%12, year=year+int(month==12))
|
last = first.replace(month=1+month%12, year=year+int(month==12))
|
||||||
|
|
||||||
disconnect = select(c, first, last)
|
disconnect = select(c, first, last)
|
||||||
by_day = {x: 0 for x in xrange(1,32)}
|
by_day = {x: 0 for x in xrange(1, 32)}
|
||||||
for adh in disconnect:
|
for adh in disconnect:
|
||||||
date = compute_fin_connexion(adh)
|
date = compute_fin_connexion(adh)
|
||||||
by_day[date.day] += 1
|
by_day[date.day] += 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue