From 13ea7aaa9ea1dd620edbeb9c68a13abffeff8f93 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 3 May 2021 11:56:41 +0200 Subject: [PATCH] Fix type demijournee --- sco_abs_views.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sco_abs_views.py b/sco_abs_views.py index 70ada694ff..59aced2cd3 100644 --- a/sco_abs_views.py +++ b/sco_abs_views.py @@ -76,8 +76,9 @@ def doSignaleAbsence( description_abs = description dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AddAbsence( etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id ) @@ -86,9 +87,8 @@ def doSignaleAbsence( ) nbadded += 2 else: - matin = int(demijournee) context._AddAbsence( - etudid, jour, matin, estjust, REQUEST, description_abs, moduleimpl_id + etudid, jour, demijournee, estjust, REQUEST, description_abs, moduleimpl_id ) nbadded += 1 # @@ -281,8 +281,9 @@ def doJustifAbsence( description_abs = description dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AddJustif( etudid=etudid, jour=jour, @@ -299,11 +300,10 @@ def doJustifAbsence( ) nbadded += 2 else: - matin = int(demijournee) context._AddJustif( etudid=etudid, jour=jour, - matin=matin, + matin=demijournee, REQUEST=REQUEST, description=description_abs, ) @@ -404,14 +404,14 @@ def doAnnuleAbsence( dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST) nbadded += 2 else: - matin = int(demijournee) - context._AnnuleAbsence(etudid, jour, matin, REQUEST=REQUEST) + context._AnnuleAbsence(etudid, jour, demijournee, REQUEST=REQUEST) nbadded += 1 # H = [ @@ -539,15 +539,15 @@ def doAnnuleJustif( etudid = etud["etudid"] dates = sco_abs.DateRangeISO(context, datedebut0, datefin0) nbadded = 0 + demijournee = int(demijournee) for jour in dates: # Attention: supprime matin et après-midi - if demijournee == "2": + if demijournee == 2: context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST) nbadded += 2 else: - matin = int(demijournee) - context._AnnuleJustif(etudid, jour, matin, REQUEST=REQUEST) + context._AnnuleJustif(etudid, jour, demijournee, REQUEST=REQUEST) nbadded += 1 # H = [ @@ -720,7 +720,7 @@ def ListeAbsEtud( ): """Liste des absences d'un étudiant sur l'année en cours En format 'html': page avec deux tableaux (non justifiées et justifiées). - En format xls ou pdf: l'un ou l'autre des table, suivant absjust_only. + En format json, xml, xls ou pdf: l'un ou l'autre des table, suivant absjust_only. En format 'text': texte avec liste d'absences (pour mails). """ absjust_only = int(absjust_only) # si vrai, table absjust seule (export xls ou pdf) @@ -732,7 +732,6 @@ def ListeAbsEtud( titles, columns_ids, absnonjust, absjust = context.Absences._TablesAbsEtud( etudid, datedebut, with_evals=with_evals, format=format ) - if REQUEST: base_url_nj = "%s?etudid=%s&absjust_only=0" % (REQUEST.URL0, etudid) base_url_j = "%s?etudid=%s&absjust_only=1" % (REQUEST.URL0, etudid)