avancement sur etat_evals, manque les 'saisie_notes'

This commit is contained in:
leonard_montalbano 2022-05-31 16:08:57 +02:00
parent 2db5e04a59
commit 73fd6bfde5

View File

@ -5,13 +5,17 @@ import app
from app import models from app import models
from app.api import bp from app.api import bp
from app.api.auth import token_auth, token_permission_required from app.api.auth import token_auth, token_permission_required
from app.models import Departement, FormSemestre, FormSemestreEtape from app.comp import res_sem
from app.comp.moy_mod import ModuleImplResults
from app.comp.res_compat import NotesTableCompat
from app.models import Departement, FormSemestre, FormSemestreEtape, Module, ModuleImpl
from app.scodoc.sco_bulletins import get_formsemestre_bulletin_etud_json from app.scodoc.sco_bulletins import get_formsemestre_bulletin_etud_json
from app.scodoc.sco_evaluation_recap import evaluations_recap_table from app.scodoc.sco_evaluation_recap import evaluations_recap_table
from app.scodoc.sco_evaluations import do_evaluation_etat_in_sem, do_evaluation_etat from app.scodoc.sco_evaluations import do_evaluation_etat_in_sem, do_evaluation_etat
from app.scodoc.sco_groups import get_etud_groups from app.scodoc.sco_groups import get_etud_groups
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_utils import ModuleType
import app.scodoc.sco_utils as scu
@bp.route("/formsemestre/<int:formsemestre_id>", methods=["GET"]) @bp.route("/formsemestre/<int:formsemestre_id>", methods=["GET"])
@ -477,11 +481,7 @@ def etat_evals(formsemestre_id: int):
Exemple de résultat : Exemple de résultat :
""" """
# fonction utilisé : do_evaluation_etat() formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
formsemestre = models.FormSemestre.query.filter_by(
id=formsemestre_id
).first_or_404()
dept = Departement.query.get(formsemestre.dept_id) dept = Departement.query.get(formsemestre.dept_id)
@ -489,34 +489,54 @@ def etat_evals(formsemestre_id: int):
list_ues = formsemestre.query_ues() list_ues = formsemestre.query_ues()
moduleimpls = formsemestre.modimpls nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
res = []
ues = {} ues = {}
modules = []
for moduleimpl in moduleimpls:
x = {}
module = models.Module.query.filter_by(id=moduleimpl.id).first_or_404()
x["id"] = module.id
x["titre"] = module.titre
list_eval = []
for eval in moduleimpl.evaluations:
list_eval.append(do_evaluation_etat(eval.id))
x["evaluations"] = list_eval
print(list_eval)
modules.append(x)
for ue in list_ues: for ue in list_ues:
modules = []
mods = ue.modules
for mod in mods:
dict_module = {}
moduleimpl = ModuleImpl.query.get_or_404(mod.id)
modimpl_results: ModuleImplResults = nt.modimpls_results[moduleimpl.id]
dict_module["id"] = mod.id
dict_module["titre"] = mod.titre
list_eval = []
for evaluation in moduleimpl.evaluations:
eval_etat = modimpl_results.evaluations_etat[evaluation.id]
eval = {}
eval["id"] = evaluation.id
eval["description"] = evaluation.description
eval["datetime_epreuve"] = evaluation.jour
eval["heure_fin"] = evaluation.heure_fin.isoformat()
eval["comptee"] = "oui" if eval_etat.is_complete else "non"
eval["inscrits"] = modimpl_results.nb_inscrits_module
eval["manquantes"] = len(
modimpl_results.evals_etudids_sans_note[evaluation.id]
)
eval["ABS"] = sum(
modimpl_results.evals_notes[evaluation.id] == scu.NOTES_ABSENCE
)
eval["ATT"] = eval_etat.nb_attente
eval["EXC"] = sum(
modimpl_results.evals_notes[evaluation.id] == scu.NOTES_NEUTRALISE
)
eval["saisie_notes"] = {
"datetime_debut": "",
"datetime_fin": "",
"datetime_mediane": "",
}
list_eval.append(eval)
dict_module["evaluations"] = list_eval
modules.append(dict_module)
ues[ue.acronyme] = modules ues[ue.acronyme] = modules
# print(ues) return jsonify(ues)
print(
"###############################################################################"
)
# print(modules)
return jsonify(do_evaluation_etat_in_sem(formsemestre_id))