affichage non conformité

This commit is contained in:
Emmanuel Viennet 2021-12-08 23:43:07 +01:00
parent ab1898b185
commit aeb0d67f38
5 changed files with 48 additions and 20 deletions

View File

@ -123,11 +123,15 @@ def notes_sem_load_cube(formsemestre):
"""Calcule le cube des notes du semestre """Calcule le cube des notes du semestre
(charge toutes les notes, calcule les moyenne des modules (charge toutes les notes, calcule les moyenne des modules
et assemble le cube) et assemble le cube)
Resultat: ndarray (etuds x modimpls x UEs) Resultat:
sem_cube : ndarray (etuds x modimpls x UEs)
modimpls_evals_poids dict { modimpl.id : evals_poids }
modimpls_evals_notes dict { modimpl.id : evals_notes }
modimpls_evaluations dict { modimpl.id : liste des évaluations }
""" """
modimpls_evals_poids = {} # modimpl.id : evals_poids modimpls_evals_poids = {}
modimpls_evals_notes = {} # modimpl.id : evals_notes modimpls_evals_notes = {}
modimpls_evaluations = {} # modimpl.id : liste des évaluations modimpls_evaluations = {}
modimpls_notes = [] modimpls_notes = []
for modimpl in formsemestre.modimpls: for modimpl in formsemestre.modimpls:
evals_notes, evaluations, evaluations_completes = moy_mod.df_load_modimpl_notes( evals_notes, evaluations, evaluations_completes = moy_mod.df_load_modimpl_notes(

View File

@ -1,8 +1,6 @@
# -*- coding: UTF-8 -* # -*- coding: UTF-8 -*
"""ScoDoc models: moduleimpls """ScoDoc models: moduleimpls
""" """
import pandas as pd import pandas as pd
from app import db from app import db

View File

@ -1172,6 +1172,8 @@ def formsemestre_tableau_modules(
fontorange = "" fontorange = ""
etat = sco_evaluations.do_evaluation_etat_in_mod(nt, modimpl["moduleimpl_id"]) etat = sco_evaluations.do_evaluation_etat_in_mod(nt, modimpl["moduleimpl_id"])
# if nt.parcours.APC_SAE:
# tbd style si module non conforme
if ( if (
etat["nb_evals_completes"] > 0 etat["nb_evals_completes"] > 0
and etat["nb_evals_en_cours"] == 0 and etat["nb_evals_en_cours"] == 0

View File

@ -32,6 +32,7 @@ import flask
from flask import url_for, g, request from flask import url_for, g, request
from app import models from app import models
from app.models.moduleimpls import ModuleImpl
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app import log from app import log
@ -227,16 +228,19 @@ def _make_table_notes(
return "<p>Aucune évaluation !</p>" return "<p>Aucune évaluation !</p>"
E = evals[0] E = evals[0]
moduleimpl_id = E["moduleimpl_id"] moduleimpl_id = E["moduleimpl_id"]
modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] modimpl_o = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
module = models.Module.query.get(modimpl["module_id"]) module = models.Module.query.get(modimpl_o["module_id"])
is_apc = module.formation.get_parcours().APC_SAE is_apc = module.formation.get_parcours().APC_SAE
if is_apc: if is_apc:
modimpl = ModuleImpl.query.get(moduleimpl_id)
is_conforme = modimpl.check_apc_conformity()
evals_poids, ues = moy_mod.df_load_evaluations_poids(moduleimpl_id) evals_poids, ues = moy_mod.df_load_evaluations_poids(moduleimpl_id)
if not ues: if not ues:
is_apc = False is_apc = False
else: else:
evals_poids, ues = None, None evals_poids, ues = None, None
sem = sco_formsemestre.get_formsemestre(modimpl["formsemestre_id"]) is_conforme = True
sem = sco_formsemestre.get_formsemestre(modimpl_o["formsemestre_id"])
# (debug) check that all evals are in same module: # (debug) check that all evals are in same module:
for e in evals: for e in evals:
if e["moduleimpl_id"] != moduleimpl_id: if e["moduleimpl_id"] != moduleimpl_id:
@ -248,7 +252,7 @@ def _make_table_notes(
keep_numeric = False keep_numeric = False
# Si pas de groupe, affiche tout # Si pas de groupe, affiche tout
if not group_ids: if not group_ids:
group_ids = [sco_groups.get_default_group(modimpl["formsemestre_id"])] group_ids = [sco_groups.get_default_group(modimpl_o["formsemestre_id"])]
groups = sco_groups.listgroups(group_ids) groups = sco_groups.listgroups(group_ids)
gr_title = sco_groups.listgroups_abbrev(groups) gr_title = sco_groups.listgroups_abbrev(groups)
@ -326,7 +330,7 @@ def _make_table_notes(
"etudid": etudid, "etudid": etudid,
"nom": etud["nom"].upper(), "nom": etud["nom"].upper(),
"_nomprenom_target": "formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s" "_nomprenom_target": "formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s"
% (modimpl["formsemestre_id"], etudid), % (modimpl_o["formsemestre_id"], etudid),
"_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % (etud["etudid"]), "_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % (etud["etudid"]),
"prenom": etud["prenom"].lower().capitalize(), "prenom": etud["prenom"].lower().capitalize(),
"nomprenom": etud["nomprenom"], "nomprenom": etud["nomprenom"],
@ -426,6 +430,7 @@ def _make_table_notes(
rows, rows,
columns_ids, columns_ids,
titles, titles,
is_conforme,
row_coefs, row_coefs,
row_poids, row_poids,
row_note_max, row_note_max,
@ -536,6 +541,10 @@ def _make_table_notes(
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id) scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
}">{module.code} {module.titre}</a></h2> }">{module.code} {module.titre}</a></h2>
""" """
if not is_conforme:
html_title += (
"""<div class="warning">Poids des évaluations non conformes !</div>"""
)
base_url = "evaluation_listenotes?moduleimpl_id=%s" % moduleimpl_id + gl base_url = "evaluation_listenotes?moduleimpl_id=%s" % moduleimpl_id + gl
# display # display
tab = GenTable( tab = GenTable(
@ -554,7 +563,7 @@ def _make_table_notes(
html_title=html_title, html_title=html_title,
pdf_title=pdf_title, pdf_title=pdf_title,
html_class="table_leftalign notes_evaluation", html_class="table_leftalign notes_evaluation",
preferences=sco_preferences.SemPreferences(modimpl["formsemestre_id"]), preferences=sco_preferences.SemPreferences(modimpl_o["formsemestre_id"]),
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete # html_generate_cells=False # la derniere ligne (moyennes) est incomplete
) )
if format == "bordereau": if format == "bordereau":
@ -797,6 +806,7 @@ def _add_apc_columns(
rows, rows,
columns_ids, columns_ids,
titles, titles,
is_conforme: bool,
row_coefs, row_coefs,
row_poids, row_poids,
row_note_max, row_note_max,
@ -809,19 +819,26 @@ def _add_apc_columns(
# => On recharge tout dans les nouveaux modèles # => On recharge tout dans les nouveaux modèles
# rows est une liste de dict avec une clé "etudid" # rows est une liste de dict avec une clé "etudid"
# on va y ajouter une clé par UE du semestre # on va y ajouter une clé par UE du semestre
modimpl = ModuleImpl.query.get(moduleimpl_id)
evals_notes, evaluations, evaluations_completes = moy_mod.df_load_modimpl_notes( evals_notes, evaluations, evaluations_completes = moy_mod.df_load_modimpl_notes(
moduleimpl_id moduleimpl_id
) )
etuds_moy_module = moy_mod.compute_module_moy( etuds_moy_module = moy_mod.compute_module_moy(
evals_notes, evals_poids, evaluations, evaluations_completes evals_notes, evals_poids, evaluations, evaluations_completes
) )
ue_coefs = models.ModuleImpl.query.get(moduleimpl_id).module.ue_coefs if is_conforme:
# valeur des moyennes vers les UEs:
for row in rows: for row in rows:
for ue in ues: for ue in ues:
moy_ue = etuds_moy_module[ue.id].get(row["etudid"], "?") moy_ue = etuds_moy_module[ue.id].get(row["etudid"], "?")
row[f"moy_ue_{ue.id}"] = scu.fmt_note(moy_ue, keep_numeric=keep_numeric) row[f"moy_ue_{ue.id}"] = scu.fmt_note(moy_ue, keep_numeric=keep_numeric)
row[f"_moy_ue_{ue.id}_class"] = "moy_ue" row[f"_moy_ue_{ue.id}_class"] = "moy_ue"
# Nom et coefs des UE (lignes titres):
ue_coefs = modimpl.module.ue_coefs
if is_conforme:
coef_class = "coef_mod_ue"
else:
coef_class = "coef_mod_ue_non_conforme"
for ue in ues: for ue in ues:
col_id = f"moy_ue_{ue.id}" col_id = f"moy_ue_{ue.id}"
titles[col_id] = ue.acronyme titles[col_id] = ue.acronyme
@ -829,4 +846,4 @@ def _add_apc_columns(
coefs = [uc for uc in ue_coefs if uc.ue_id == ue.id] coefs = [uc for uc in ue_coefs if uc.ue_id == ue.id]
if coefs: if coefs:
row_coefs[f"moy_ue_{ue.id}"] = coefs[0].coef row_coefs[f"moy_ue_{ue.id}"] = coefs[0].coef
row_coefs[f"_moy_ue_{ue.id}_td_attrs"] = ' class="coef_mod_ue" ' row_coefs[f"_moy_ue_{ue.id}_td_attrs"] = f' class="{coef_class}" '

View File

@ -1072,6 +1072,13 @@ td.coef_mod_ue {
color: rgb(1, 116, 96); color: rgb(1, 116, 96);
} }
td.coef_mod_ue_non_conforme {
font-style: normal;
font-weight: bold;
color: red;
background-color: yellow;
}
h2.formsemestre, #gtrcontent h2 { h2.formsemestre, #gtrcontent h2 {
margin-top: 2px; margin-top: 2px;
font-size: 130%; font-size: 130%;