1
0
forked from ScoDoc/ScoDoc

Recap: rangs dans les groupes

This commit is contained in:
Emmanuel Viennet 2022-05-23 10:59:43 +02:00
parent 8a1569ac54
commit 994959960c
4 changed files with 36 additions and 10 deletions

View File

@ -70,6 +70,7 @@ class ResultatsSemestre(ResultatsCache):
self.etud_moy_gen: pd.Series = None self.etud_moy_gen: pd.Series = None
self.etud_moy_gen_ranks = {} self.etud_moy_gen_ranks = {}
self.etud_moy_gen_ranks_int = {} self.etud_moy_gen_ranks_int = {}
self.moy_gen_rangs_by_group = None # virtual
self.modimpl_inscr_df: pd.DataFrame = None self.modimpl_inscr_df: pd.DataFrame = None
"Inscriptions: row etudid, col modimlpl_id" "Inscriptions: row etudid, col modimlpl_id"
self.modimpls_results: ModuleImplResults = None self.modimpls_results: ModuleImplResults = None
@ -824,17 +825,25 @@ class ResultatsSemestre(ResultatsCache):
self.formsemestre.id self.formsemestre.id
) )
first_partition = True first_partition = True
col_order = 10
for partition in partitions: for partition in partitions:
cid = f"part_{partition['partition_id']}" cid = f"part_{partition['partition_id']}"
rg_cid = cid + "_rg" # rang dans la partition
titles[cid] = partition["partition_name"] titles[cid] = partition["partition_name"]
if first_partition: if first_partition:
klass = "partition" klass = "partition"
else: else:
klass = "partition partition_aux" klass = "partition partition_aux"
titles[f"_{cid}_class"] = klass 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"]] partition_etud_groups = partitions_etud_groups[partition["partition_id"]]
for row in rows: for row in rows:
group = None # group (dict) de l'étudiant dans cette partition
# dans NotesTableCompat, à revoir # dans NotesTableCompat, à revoir
etud_etat = self.get_etud_etat(row["etudid"]) etud_etat = self.get_etud_etat(row["etudid"])
if etud_etat == "D": if etud_etat == "D":
@ -847,8 +856,17 @@ class ResultatsSemestre(ResultatsCache):
group = partition_etud_groups.get(row["etudid"]) group = partition_etud_groups.get(row["etudid"])
gr_name = group["group_name"] if group else "" gr_name = group["group_name"] if group else ""
if gr_name: if gr_name:
row[f"{cid}"] = gr_name row[cid] = gr_name
row[f"_{cid}_class"] = klass 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 first_partition = False
def _recap_add_evaluations( def _recap_add_evaluations(

View File

@ -1046,9 +1046,7 @@ def partition_set_attr(partition_id, attr, value):
partition[attr] = value partition[attr] = value
partitionEditor.edit(cnx, partition) partitionEditor.edit(cnx, partition)
# invalid bulletin cache # invalid bulletin cache
sco_cache.invalidate_formsemestre( sco_cache.invalidate_formsemestre(formsemestre_id=partition["formsemestre_id"])
pdfonly=True, formsemestre_id=partition["formsemestre_id"]
)
return "enregistré" return "enregistré"

View File

@ -15,13 +15,23 @@ $(function () {
}, },
{ {
name: "toggle_partitions", name: "toggle_partitions",
text: "Toutes les partitions", text: "Montrer groupes",
action: function (e, dt, node, config) { action: function (e, dt, node, config) {
let visible = dt.columns(".partition_aux").visible()[0]; let visible = dt.columns(".partition_aux").visible()[0];
dt.columns(".partition_aux").visible(!visible); 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")) { if (!$('table.table_recap').hasClass("jury")) {
buttons.push( buttons.push(
$('table.table_recap').hasClass("apc") ? $('table.table_recap').hasClass("apc") ?
@ -95,7 +105,7 @@ $(function () {
"columnDefs": [ "columnDefs": [
{ {
// cache les codes, le détail de l'identité, les groupes, les colonnes admission et les vides // 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, visible: false,
}, },
{ {

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.2.22" SCOVERSION = "9.2.23"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"