From 994959960cc3e3eeaf954416d64cbcc9c5031594 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 23 May 2022 10:59:43 +0200 Subject: [PATCH] Recap: rangs dans les groupes --- app/comp/res_common.py | 22 ++++++++++++++++++++-- app/scodoc/sco_groups.py | 4 +--- app/static/js/table_recap.js | 18 ++++++++++++++---- sco_version.py | 2 +- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 5170875d71..654a1ae361 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -70,6 +70,7 @@ class ResultatsSemestre(ResultatsCache): self.etud_moy_gen: pd.Series = None self.etud_moy_gen_ranks = {} self.etud_moy_gen_ranks_int = {} + self.moy_gen_rangs_by_group = None # virtual self.modimpl_inscr_df: pd.DataFrame = None "Inscriptions: row etudid, col modimlpl_id" self.modimpls_results: ModuleImplResults = None @@ -824,17 +825,25 @@ class ResultatsSemestre(ResultatsCache): self.formsemestre.id ) first_partition = True + col_order = 10 for partition in partitions: cid = f"part_{partition['partition_id']}" + rg_cid = cid + "_rg" # rang dans la partition titles[cid] = partition["partition_name"] if first_partition: klass = "partition" else: klass = "partition partition_aux" titles[f"_{cid}_class"] = klass - titles[f"_{cid}_col_order"] = 10 + titles[f"_{cid}_col_order"] = col_order + titles[f"_{rg_cid}_col_order"] = col_order + 1 + col_order += 2 + if partition["bul_show_rank"]: + titles[rg_cid] = f"Rg {partition['partition_name']}" + titles[f"_{rg_cid}_class"] = "partition_rangs" partition_etud_groups = partitions_etud_groups[partition["partition_id"]] for row in rows: + group = None # group (dict) de l'étudiant dans cette partition # dans NotesTableCompat, à revoir etud_etat = self.get_etud_etat(row["etudid"]) if etud_etat == "D": @@ -847,8 +856,17 @@ class ResultatsSemestre(ResultatsCache): group = partition_etud_groups.get(row["etudid"]) gr_name = group["group_name"] if group else "" if gr_name: - row[f"{cid}"] = gr_name + row[cid] = gr_name row[f"_{cid}_class"] = klass + # Rangs dans groupe + if ( + partition["bul_show_rank"] + and (group is not None) + and (group["id"] in self.moy_gen_rangs_by_group) + ): + rang = self.moy_gen_rangs_by_group[group["id"]][0] + row[rg_cid] = rang.get(row["etudid"], "") + first_partition = False def _recap_add_evaluations( diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index d316640fc2..79ed91cad1 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -1046,9 +1046,7 @@ def partition_set_attr(partition_id, attr, value): partition[attr] = value partitionEditor.edit(cnx, partition) # invalid bulletin cache - sco_cache.invalidate_formsemestre( - pdfonly=True, formsemestre_id=partition["formsemestre_id"] - ) + sco_cache.invalidate_formsemestre(formsemestre_id=partition["formsemestre_id"]) return "enregistré" diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js index 36426b508b..fd5068e609 100644 --- a/app/static/js/table_recap.js +++ b/app/static/js/table_recap.js @@ -15,13 +15,23 @@ $(function () { }, { name: "toggle_partitions", - text: "Toutes les partitions", + text: "Montrer groupes", action: function (e, dt, node, config) { let visible = dt.columns(".partition_aux").visible()[0]; dt.columns(".partition_aux").visible(!visible); - dt.buttons('toggle_partitions:name').text(visible ? "Toutes les partitions" : "Cacher les partitions"); + dt.buttons('toggle_partitions:name').text(visible ? "Montrer groupes" : "Cacher les groupes"); } - }]; + }, + { + name: "toggle_partitions_rangs", + text: "Rangs groupes", + action: function (e, dt, node, config) { + let rangs_visible = dt.columns(".partition_rangs").visible()[0]; + dt.columns(".partition_rangs").visible(!rangs_visible); + dt.buttons('toggle_partitions_rangs:name').text(rangs_visible ? "Rangs groupes" : "Cacher rangs groupes"); + } + }, + ]; if (!$('table.table_recap').hasClass("jury")) { buttons.push( $('table.table_recap').hasClass("apc") ? @@ -95,7 +105,7 @@ $(function () { "columnDefs": [ { // cache les codes, le détail de l'identité, les groupes, les colonnes admission et les vides - targets: ["codes", "identite_detail", "partition_aux", "admission", "col_empty"], + targets: ["codes", "identite_detail", "partition_aux", "partition_rangs", "admission", "col_empty"], visible: false, }, { diff --git a/sco_version.py b/sco_version.py index 3222274fa8..d3dd51f248 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.2.22" +SCOVERSION = "9.2.23" SCONAME = "ScoDoc"