From 6030d12acaa61c18a39c30c00fdcb6f14ee49733 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 22 May 2022 07:02:01 +0200 Subject: [PATCH] Ajout colonne parcours sur table description semestre --- app/scodoc/sco_formsemestre_status.py | 47 ++++++++++++++++++--------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 71823e10..10e5dbe9 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -40,6 +40,7 @@ from app.comp import res_sem from app.comp.res_compat import NotesTableCompat from app.models import Module from app.models.formsemestre import FormSemestre +from app.models.moduleimpls import ModuleImpl import app.scodoc.sco_utils as scu from app.scodoc.sco_utils import ModuleType import app.scodoc.notesdb as ndb @@ -578,7 +579,9 @@ def fill_formsemestre(sem): # Description du semestre sous forme de table exportable -def formsemestre_description_table(formsemestre_id, with_evals=False): +def formsemestre_description_table( + formsemestre_id, with_evals=False, with_parcours=False +): """Description du semestre sous forme de table exportable Liste des modules et de leurs coefficients """ @@ -618,7 +621,7 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): ue_info["Coef._class"] = "ue_coef" R.append(ue_info) - ModInscrits = sco_moduleimpl.do_moduleimpl_inscription_list( + mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list( moduleimpl_id=M["moduleimpl_id"] ) enseignants = ", ".join( @@ -629,7 +632,7 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): "Code": M["module"]["code"] or "", "Module": M["module"]["abbrev"] or M["module"]["titre"], "_Module_class": "scotext", - "Inscrits": len(ModInscrits), + "Inscrits": len(mod_inscrits), "Responsable": sco_users.user_info(M["responsable_id"])["nomprenom"], "_Responsable_class": "scotext", "Enseignants": enseignants, @@ -648,10 +651,15 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): moduleimpl_id=M["moduleimpl_id"], ), } - R.append(l) if M["module"]["coefficient"]: sum_coef += M["module"]["coefficient"] + if with_parcours: + module = Module.query.get(M["module_id"]) + l["parcours"] = ", ".join(sorted([pa.code for pa in module.parcours])) + + R.append(l) + if with_evals: # Ajoute lignes pour evaluations evals = nt.get_mod_evaluation_etat_list(M["moduleimpl_id"]) @@ -676,7 +684,10 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): sums = {"_css_row_class": "moyenne sortbottom", "ects": sum_ects, "Coef.": sum_coef} R.append(sums) - columns_ids = ["UE", "Code", "Module", "Coef."] + columns_ids = ["UE", "Code", "Module"] + if with_parcours: + columns_ids += ["parcours"] + columns_ids += ["Coef."] if sco_preferences.get_preference("bul_show_ects", formsemestre_id): columns_ids += ["ects"] columns_ids += ["Inscrits", "Responsable", "Enseignants"] @@ -696,6 +707,7 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): titles["description"] = "" titles["coefficient"] = "Coef. éval." titles["evalcomplete_str"] = "Complète" + titles["parcours"] = "Parcours" titles["publish_incomplete_str"] = "Toujours Utilisée" title = "%s %s" % (parcours.SESSION_NAME.capitalize(), formsemestre.titre_mois()) @@ -720,21 +732,26 @@ def formsemestre_description_table(formsemestre_id, with_evals=False): ) -def formsemestre_description(formsemestre_id, format="html", with_evals=False): +def formsemestre_description( + formsemestre_id, format="html", with_evals=False, with_parcours=False +): """Description du semestre sous forme de table exportable Liste des modules et de leurs coefficients """ with_evals = int(with_evals) - tab = formsemestre_description_table(formsemestre_id, with_evals=with_evals) - tab.html_before_table = """
- - + + indiquer les évaluations + indiquer les parcours BUT + """ return tab.make_page(format=format)