2021-07-02 12:34:44 +02:00
|
|
|
""" Parametre demijournee ne fonctionne pas lorsque demijournee = 2
|
|
|
|
Créer et justifier des absences en utilisant le parametre demijournee
|
|
|
|
"""
|
|
|
|
import random
|
|
|
|
|
|
|
|
# La variable context est définie par le script de lancement
|
|
|
|
# l'affecte ainsi pour évietr les warnins pylint:
|
|
|
|
context = context # pylint: disable=undefined-variable
|
|
|
|
REQUEST = REQUEST # pylint: disable=undefined-variable
|
|
|
|
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
|
|
|
import sco_abs
|
|
|
|
import sco_abs_views
|
|
|
|
import sco_abs_notification
|
|
|
|
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes)
|
|
|
|
G.verbose = False
|
|
|
|
|
|
|
|
# --- Création d'étudiants
|
|
|
|
etud = G.create_etud(code_nip=None)
|
|
|
|
|
|
|
|
# --- Création d'une formation
|
|
|
|
f = G.create_formation(acronyme="")
|
|
|
|
ue = G.create_ue(formation_id=f["formation_id"], acronyme="TST1", titre="ue test")
|
|
|
|
mat = G.create_matiere(ue_id=ue["ue_id"], titre="matière test")
|
|
|
|
mod = G.create_module(
|
|
|
|
matiere_id=mat["matiere_id"],
|
|
|
|
code="TSM1",
|
|
|
|
coefficient=1.0,
|
|
|
|
titre="module test",
|
|
|
|
ue_id=ue["ue_id"], # faiblesse de l'API
|
|
|
|
formation_id=f["formation_id"], # faiblesse de l'API
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Mise place d'un semestre
|
|
|
|
sem = G.create_formsemestre(
|
|
|
|
formation_id=f["formation_id"],
|
|
|
|
semestre_id=1,
|
|
|
|
date_debut="01/01/2021",
|
|
|
|
date_fin="30/06/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
mi = G.create_moduleimpl(
|
|
|
|
module_id=mod["module_id"],
|
|
|
|
formsemestre_id=sem["formsemestre_id"],
|
|
|
|
responsable_id="bach",
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Inscription des étudiants
|
|
|
|
G.inscrit_etudiant(sem, etud)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Saisie absences
|
|
|
|
etudid = etud["etudid"]
|
|
|
|
|
|
|
|
_ = sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"15/01/2021",
|
|
|
|
"15/01/2021",
|
|
|
|
demijournee=2,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
_ = sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"18/01/2021",
|
|
|
|
"18/01/2021",
|
|
|
|
demijournee=1,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
_ = sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"19/01/2021",
|
|
|
|
"19/01/2021",
|
|
|
|
demijournee=0,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Justification de certaines absences
|
|
|
|
|
|
|
|
_ = sco_abs_views.doJustifAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"18/01/2021",
|
|
|
|
"18/01/2021",
|
|
|
|
demijournee=1,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
_ = sco_abs_views.doJustifAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"19/01/2021",
|
|
|
|
"19/01/2021",
|
|
|
|
demijournee=2,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
# NE JUSTIFIE QUE LE MATIN MALGRES LE PARAMETRE demijournee = 2
|
|
|
|
|
|
|
|
# --- Test
|
|
|
|
|
2021-07-19 19:53:01 +02:00
|
|
|
nbabs, nbabs_just = sco_abs.get_abs_count(etudid, sem)
|
|
|
|
assert (
|
|
|
|
nbabs == 4
|
|
|
|
) # l'étudiant a été absent le 15 journée compléte (2 abs : 1 matin, 1 apres midi) et le 18 (1 matin), et le 19 (1 apres midi).
|
|
|
|
assert nbabs_just == 2 # Justifie abs du matin + abs après midi
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
Commentaire :
|
|
|
|
|
|
|
|
Pb : le 2 ne peut pas être pris en tant que int car string dans la fonction
|
2021-07-19 19:53:01 +02:00
|
|
|
-----> Pb reglé
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
"""
|