2021-05-18 11:31:39 +02:00
|
|
|
""" Création d'une formation, d'élève de 2 ue dans un semestre et de 6 évaluations par 3 fonction différentes :
|
|
|
|
create_eval, evaluation_create et do_evaluation_create. Saisir les notes des évaluations, lister ces evaluations,
|
2021-06-09 19:21:58 +02:00
|
|
|
supprimer et modifier une evaluation
|
|
|
|
|
|
|
|
Fonction de l'API utilisé :
|
|
|
|
- create_evaluation
|
|
|
|
- evaluation_create
|
|
|
|
- do_evaluation_create
|
|
|
|
- do_evaluation_list_in_formsemestre
|
|
|
|
- do_evaluation_list
|
|
|
|
- create_note
|
|
|
|
- check_absences
|
|
|
|
- do_evaluation_etat
|
|
|
|
- evaluation_supress_alln
|
|
|
|
- do_evaluation_edit
|
|
|
|
- do_evaluation_delete
|
|
|
|
|
|
|
|
"""
|
2021-05-18 11:31:39 +02:00
|
|
|
|
|
|
|
import sys
|
|
|
|
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_moduleimpl
|
|
|
|
import sco_liste_notes
|
|
|
|
import sco_evaluations
|
|
|
|
import sco_undo_notes
|
|
|
|
import sco_abs_views
|
|
|
|
import sco_saisie_notes
|
|
|
|
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes)
|
|
|
|
G.verbose = False
|
|
|
|
|
|
|
|
# --- Création d'étudiants
|
|
|
|
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
|
|
|
|
|
|
|
# --- Création d'une formation et de deux UE
|
|
|
|
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
|
|
|
|
)
|
|
|
|
|
|
|
|
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="TST2", titre="ue test2")
|
|
|
|
mat2 = G.create_matiere(ue_id=ue2["ue_id"], titre="matière test2")
|
|
|
|
mod2 = G.create_module(
|
|
|
|
matiere_id=mat2["matiere_id"],
|
|
|
|
code="TSM2",
|
|
|
|
coefficient=1.0,
|
|
|
|
titre="module test2",
|
|
|
|
ue_id=ue2["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",
|
|
|
|
)
|
|
|
|
|
|
|
|
mi2 = G.create_moduleimpl(
|
|
|
|
module_id=mod2["module_id"],
|
|
|
|
formsemestre_id=sem["formsemestre_id"],
|
|
|
|
responsable_id="bach",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Inscription des étudiants
|
|
|
|
for etud in etuds:
|
|
|
|
G.inscrit_etudiant(sem, etud)
|
|
|
|
|
|
|
|
# --- Création des évaluations
|
|
|
|
|
|
|
|
#création d'éval avec create_evaluation
|
|
|
|
e = G.create_evaluation(
|
|
|
|
moduleimpl_id=mi["moduleimpl_id"],
|
|
|
|
jour="7/01/2021",
|
|
|
|
description="evaluation test 1",
|
|
|
|
coefficient=1.0,
|
|
|
|
)
|
|
|
|
|
|
|
|
e2 = G.create_evaluation(
|
|
|
|
moduleimpl_id=mi2["moduleimpl_id"],
|
|
|
|
jour="11/01/2021",
|
|
|
|
description="evaluation test 2",
|
|
|
|
coefficient=1.0,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#création d'éval avec evaluation_create
|
|
|
|
#e3 = context.Notes.evaluation_create(mi["moduleimpl_id"], REQUEST)
|
|
|
|
#e4 = context.Notes.evaluation_create(mi2["moduleimpl_id"], REQUEST) # rien ne se passe
|
|
|
|
|
|
|
|
#création d'éval avec do_evaluation_create ! WARNING : retourne l'id de l'éval !
|
|
|
|
e5 = context.Notes.do_evaluation_create(
|
|
|
|
moduleimpl_id=mi["moduleimpl_id"],
|
|
|
|
jour="01/02/2021",
|
|
|
|
heure_debut="9h0",
|
|
|
|
heure_fin="11h0",
|
|
|
|
description="evaluation test 5",
|
|
|
|
note_max="20.0",
|
|
|
|
coefficient="1",
|
|
|
|
REQUEST=REQUEST
|
|
|
|
)
|
|
|
|
|
|
|
|
e6 = context.Notes.do_evaluation_create(
|
|
|
|
moduleimpl_id=mi2["moduleimpl_id"],
|
|
|
|
jour="01/02/2021",
|
|
|
|
heure_debut="13h0",
|
|
|
|
heure_fin="15h0",
|
|
|
|
description="evaluation test 6",
|
|
|
|
note_max="20.0",
|
|
|
|
coefficient="1",
|
|
|
|
REQUEST=REQUEST
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Liste des évaluations dans le semestre
|
|
|
|
|
|
|
|
lie = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
|
|
|
assert len(lie) == 4
|
|
|
|
""" print(lie[0])
|
|
|
|
print(" ")
|
|
|
|
print(lie[1])
|
|
|
|
print(" ")
|
|
|
|
print(lie[2])
|
|
|
|
print(" ")
|
|
|
|
print(lie[3]) """
|
|
|
|
|
|
|
|
eval5 = context.Notes.do_evaluation_list({"evaluation_id" : e5})[0]
|
|
|
|
eval6 = context.Notes.do_evaluation_list({"evaluation_id" : e6})[0]
|
|
|
|
|
|
|
|
# --- Saisie des absences aux évaluations
|
|
|
|
|
|
|
|
_ = sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"7/01/2021",
|
|
|
|
"7/01/2021",
|
|
|
|
demijournee=1,
|
|
|
|
etudid=etuds[0]["etudid"],
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
_ = sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"01/02/2021",
|
|
|
|
"01/02/2021",
|
|
|
|
demijournee=1,
|
|
|
|
etudid=etuds[1]["etudid"],
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
_ = sco_abs_views.doJustifAbsence(
|
|
|
|
context.Absences,
|
|
|
|
"01/02/2021",
|
|
|
|
"01/02/2021",
|
|
|
|
demijournee=1,
|
|
|
|
etudid=etuds[1]["etudid"],
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Saisie des notes
|
|
|
|
|
|
|
|
evals = [e,e2,eval5,eval6]
|
|
|
|
|
|
|
|
for eval in evals :
|
|
|
|
for etud in etuds:
|
|
|
|
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
|
|
|
evaluation=eval, etud=etud, note=float(random.randint(0, 20))
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Check abs
|
|
|
|
|
|
|
|
check = sco_liste_notes.evaluation_check_absences(context.Notes, evaluation_id=e["evaluation_id"])
|
|
|
|
|
|
|
|
check2 = sco_liste_notes.evaluation_check_absences(context.Notes, evaluation_id=e2["evaluation_id"])
|
|
|
|
|
|
|
|
# --- Liste de note d'une évaluation
|
|
|
|
|
2021-06-09 19:21:58 +02:00
|
|
|
#lien = sco_liste_notes.do_evaluation_listenotes(context=context.Notes, REQUEST=REQUEST)
|
2021-05-18 11:31:39 +02:00
|
|
|
|
|
|
|
cal = sco_evaluations.formsemestre_evaluations_cal(context.Notes, formsemestre_id=sem["formsemestre_id"], REQUEST=REQUEST)
|
|
|
|
#html
|
|
|
|
|
|
|
|
delai = sco_evaluations.formsemestre_evaluations_delai_correction(context.Notes, formsemestre_id=sem["formsemestre_id"], format="json", REQUEST=REQUEST)
|
|
|
|
#html
|
|
|
|
|
|
|
|
lio = sco_undo_notes.evaluation_list_operations(context.Notes, evaluation_id=e["evaluation_id"], REQUEST=REQUEST)
|
|
|
|
#html
|
|
|
|
|
|
|
|
|
|
|
|
# --- Supression de toutes les notes d'une évaluations
|
|
|
|
|
|
|
|
etat = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
|
|
|
assert etat["evalcomplete"]
|
|
|
|
sco_saisie_notes.evaluation_suppress_alln(context.Notes, e2["evaluation_id"], REQUEST=REQUEST)
|
|
|
|
etat2 = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
|
|
|
|
|
|
|
#assert not etat2["evalcomplete"] rien ne se passe...
|
|
|
|
|
|
|
|
# --- Modification d'une évaluation
|
|
|
|
|
|
|
|
context.Notes.do_evaluation_edit(REQUEST=REQUEST, args={"evaluation_id" : e5, "coefficient": 2.0 ,
|
|
|
|
"description" : "modification", "note_max" : 20,
|
|
|
|
"heure_debut" : "8h0", "heure_fin" : "10h0", "jour" : "03/02/2021"})
|
|
|
|
new_eval5 = context.Notes.do_evaluation_list({"evaluation_id" : e5})[0]
|
|
|
|
|
|
|
|
assert new_eval5["description"] == "modification"
|
|
|
|
assert new_eval5["jour"] == "03/02/2021"
|
|
|
|
assert new_eval5["heure_debut"] == "08h00"
|
|
|
|
assert new_eval5["heure_fin"] == "10h00"
|
|
|
|
assert new_eval5["coefficient"] == 2.0
|
|
|
|
|
|
|
|
# --- Supression d'une évaluation
|
|
|
|
|
|
|
|
e7 = G.create_evaluation(
|
|
|
|
moduleimpl_id=mi["moduleimpl_id"],
|
|
|
|
jour="7/01/2021",
|
|
|
|
description="evaluation test 7",
|
|
|
|
coefficient=1.0,
|
|
|
|
)
|
|
|
|
|
|
|
|
lie = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
|
|
|
assert len(lie) == 5
|
|
|
|
|
|
|
|
#context.Notes.evaluation_delete(REQUEST=REQUEST, evaluation_id=e7) rien ne se passe
|
|
|
|
sco_evaluations.do_evaluation_delete(context.Notes, REQUEST=REQUEST, evaluation_id=e7["evaluation_id"])
|
|
|
|
lie2 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
|
|
|
assert len(lie2) == 4
|
2021-06-09 19:21:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
Commentaire :
|
|
|
|
|
|
|
|
Plusieurs fonction retourne de l'HTML, les notes ne se suppriment pas malgre l'utilisation de la fonction
|
|
|
|
evaluation_supress_alln (voir mini test). evaluation_delete ---> rien ne se passe.
|
|
|
|
|
|
|
|
"""
|