Fix type demijournee

This commit is contained in:
Emmanuel Viennet 2021-05-03 11:56:41 +02:00
parent 295ff983a1
commit 13ea7aaa9e

View File

@ -76,8 +76,9 @@ def doSignaleAbsence(
description_abs = description description_abs = description
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AddAbsence( context._AddAbsence(
etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id
) )
@ -86,9 +87,8 @@ def doSignaleAbsence(
) )
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee)
context._AddAbsence( context._AddAbsence(
etudid, jour, matin, estjust, REQUEST, description_abs, moduleimpl_id etudid, jour, demijournee, estjust, REQUEST, description_abs, moduleimpl_id
) )
nbadded += 1 nbadded += 1
# #
@ -281,8 +281,9 @@ def doJustifAbsence(
description_abs = description description_abs = description
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AddJustif( context._AddJustif(
etudid=etudid, etudid=etudid,
jour=jour, jour=jour,
@ -299,11 +300,10 @@ def doJustifAbsence(
) )
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee)
context._AddJustif( context._AddJustif(
etudid=etudid, etudid=etudid,
jour=jour, jour=jour,
matin=matin, matin=demijournee,
REQUEST=REQUEST, REQUEST=REQUEST,
description=description_abs, description=description_abs,
) )
@ -404,14 +404,14 @@ def doAnnuleAbsence(
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST)
context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST)
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee) context._AnnuleAbsence(etudid, jour, demijournee, REQUEST=REQUEST)
context._AnnuleAbsence(etudid, jour, matin, REQUEST=REQUEST)
nbadded += 1 nbadded += 1
# #
H = [ H = [
@ -539,15 +539,15 @@ def doAnnuleJustif(
etudid = etud["etudid"] etudid = etud["etudid"]
dates = sco_abs.DateRangeISO(context, datedebut0, datefin0) dates = sco_abs.DateRangeISO(context, datedebut0, datefin0)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
# Attention: supprime matin et après-midi # Attention: supprime matin et après-midi
if demijournee == "2": if demijournee == 2:
context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST)
context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST)
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee) context._AnnuleJustif(etudid, jour, demijournee, REQUEST=REQUEST)
context._AnnuleJustif(etudid, jour, matin, REQUEST=REQUEST)
nbadded += 1 nbadded += 1
# #
H = [ H = [
@ -720,7 +720,7 @@ def ListeAbsEtud(
): ):
"""Liste des absences d'un étudiant sur l'année en cours """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 '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). En format 'text': texte avec liste d'absences (pour mails).
""" """
absjust_only = int(absjust_only) # si vrai, table absjust seule (export xls ou pdf) 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( titles, columns_ids, absnonjust, absjust = context.Absences._TablesAbsEtud(
etudid, datedebut, with_evals=with_evals, format=format etudid, datedebut, with_evals=with_evals, format=format
) )
if REQUEST: if REQUEST:
base_url_nj = "%s?etudid=%s&absjust_only=0" % (REQUEST.URL0, etudid) base_url_nj = "%s?etudid=%s&absjust_only=0" % (REQUEST.URL0, etudid)
base_url_j = "%s?etudid=%s&absjust_only=1" % (REQUEST.URL0, etudid) base_url_j = "%s?etudid=%s&absjust_only=1" % (REQUEST.URL0, etudid)