From aeb0d67f3864900f5a2690e182043d18978e4a51 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 8 Dec 2021 23:43:07 +0100 Subject: [PATCH] =?UTF-8?q?affichage=20non=20conformit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/moy_ue.py | 12 ++++--- app/models/moduleimpls.py | 2 -- app/scodoc/sco_formsemestre_status.py | 2 ++ app/scodoc/sco_liste_notes.py | 45 ++++++++++++++++++--------- app/static/css/scodoc.css | 7 +++++ 5 files changed, 48 insertions(+), 20 deletions(-) diff --git a/app/comp/moy_ue.py b/app/comp/moy_ue.py index 9a722f255..06d0b2c54 100644 --- a/app/comp/moy_ue.py +++ b/app/comp/moy_ue.py @@ -123,11 +123,15 @@ def notes_sem_load_cube(formsemestre): """Calcule le cube des notes du semestre (charge toutes les notes, calcule les moyenne des modules 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_notes = {} # modimpl.id : evals_notes - modimpls_evaluations = {} # modimpl.id : liste des évaluations + modimpls_evals_poids = {} + modimpls_evals_notes = {} + modimpls_evaluations = {} modimpls_notes = [] for modimpl in formsemestre.modimpls: evals_notes, evaluations, evaluations_completes = moy_mod.df_load_modimpl_notes( diff --git a/app/models/moduleimpls.py b/app/models/moduleimpls.py index 05bd592a0..2da7cb01f 100644 --- a/app/models/moduleimpls.py +++ b/app/models/moduleimpls.py @@ -1,8 +1,6 @@ # -*- coding: UTF-8 -* - """ScoDoc models: moduleimpls """ - import pandas as pd from app import db diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 48af5949c..995d9f878 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -1172,6 +1172,8 @@ def formsemestre_tableau_modules( fontorange = "" etat = sco_evaluations.do_evaluation_etat_in_mod(nt, modimpl["moduleimpl_id"]) + # if nt.parcours.APC_SAE: + # tbd style si module non conforme if ( etat["nb_evals_completes"] > 0 and etat["nb_evals_en_cours"] == 0 diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index dd465fc02..70a0fb94a 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -32,6 +32,7 @@ import flask from flask import url_for, g, request from app import models +from app.models.moduleimpls import ModuleImpl import app.scodoc.sco_utils as scu import app.scodoc.notesdb as ndb from app import log @@ -227,16 +228,19 @@ def _make_table_notes( return "

Aucune évaluation !

" E = evals[0] moduleimpl_id = E["moduleimpl_id"] - modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] - module = models.Module.query.get(modimpl["module_id"]) + modimpl_o = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] + module = models.Module.query.get(modimpl_o["module_id"]) is_apc = module.formation.get_parcours().APC_SAE 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) if not ues: is_apc = False else: 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: for e in evals: if e["moduleimpl_id"] != moduleimpl_id: @@ -248,7 +252,7 @@ def _make_table_notes( keep_numeric = False # Si pas de groupe, affiche tout 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) gr_title = sco_groups.listgroups_abbrev(groups) @@ -326,7 +330,7 @@ def _make_table_notes( "etudid": etudid, "nom": etud["nom"].upper(), "_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"]), "prenom": etud["prenom"].lower().capitalize(), "nomprenom": etud["nomprenom"], @@ -426,6 +430,7 @@ def _make_table_notes( rows, columns_ids, titles, + is_conforme, row_coefs, row_poids, row_note_max, @@ -536,6 +541,10 @@ def _make_table_notes( scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id) }">{module.code} {module.titre} """ + if not is_conforme: + html_title += ( + """
Poids des évaluations non conformes !
""" + ) base_url = "evaluation_listenotes?moduleimpl_id=%s" % moduleimpl_id + gl # display tab = GenTable( @@ -554,7 +563,7 @@ def _make_table_notes( html_title=html_title, pdf_title=pdf_title, 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 ) if format == "bordereau": @@ -797,6 +806,7 @@ def _add_apc_columns( rows, columns_ids, titles, + is_conforme: bool, row_coefs, row_poids, row_note_max, @@ -809,19 +819,26 @@ def _add_apc_columns( # => On recharge tout dans les nouveaux modèles # rows est une liste de dict avec une clé "etudid" # 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( moduleimpl_id ) etuds_moy_module = moy_mod.compute_module_moy( evals_notes, evals_poids, evaluations, evaluations_completes ) - ue_coefs = models.ModuleImpl.query.get(moduleimpl_id).module.ue_coefs - for row in rows: - for ue in ues: - 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}_class"] = "moy_ue" + if is_conforme: + # valeur des moyennes vers les UEs: + for row in rows: + for ue in ues: + 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}_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: col_id = f"moy_ue_{ue.id}" 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] if coefs: 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}" ' diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index e92e4ca2e..c5a43d621 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1072,6 +1072,13 @@ td.coef_mod_ue { 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 { margin-top: 2px; font-size: 130%;