Amélioration table recap. Cas sans moyenne gen.

This commit is contained in:
Emmanuel Viennet 2023-02-06 18:59:51 +01:00
parent 50f1698195
commit 40d313be41
5 changed files with 54 additions and 31 deletions

View File

@ -3994,6 +3994,7 @@ div.table_recap {
div.table_recap table.table_recap {
width: auto;
/* font-family: Consolas, monaco, monospace; */
}
table.table_recap tr.selected td {

View File

@ -11,7 +11,7 @@ $(function () {
let mode_jury_but_bilan = $('table.table_recap').hasClass("table_jury_but_bilan");
if (mode_jury_but_bilan) {
// table bilan décisions: cache les notes
hidden_colums = hidden_colums.concat(["col_ue", "col_rcue", "col_lien_saisie_but"]);
hidden_colums = hidden_colums.concat(["col_lien_saisie_but"]);
}
// Etat (tri des colonnes) de la table:
@ -32,7 +32,7 @@ $(function () {
}
}
// Les colonnes visibles étant mémorisé, il faut initialiser les titres des boutons
// Les colonnes visibles étant mémorisées, il faut initialiser les titres des boutons
function update_buttons_labels(dt) {
console.log("update_buttons_labels");
dt.buttons('toggle_ident:name').text(dt.columns(".identite_detail").visible()[0] ? "Nom seul" : "Civ/Nom/Prénom");

View File

@ -35,6 +35,8 @@ from app.scodoc import sco_pvjury
from app.scodoc import sco_utils as scu
from app.tables.recap import RowRecap, TableRecap
EMO_EMPTY_CODE_JURY = "🏮" # "🍽" "🚨"
class TableJury(TableRecap):
"""Cette table recap reprend les colonnes du tableau recap, sauf les évaluations,
@ -100,7 +102,11 @@ class TableJury(TableRecap):
else:
jury_code_sem = ""
row.add_cell(
"jury_code_sem", "Jury", jury_code_sem, group="jury_code_sem"
"jury_code_sem",
"Jury",
jury_code_sem or "🍽",
raw_content=jury_code_sem,
group="jury_code_sem",
)
self.foot_title_row.cells["jury_code_sem"].target_attrs[
"title"
@ -109,7 +115,7 @@ class TableJury(TableRecap):
row.add_cell(
"jury_link",
"",
f"""{("modifier" if res.validations and res.validations.has_decision(etud) else "saisir")
f"""{("modifier" if res.validations and res.validations.has_decision(etud) else "➨ saisir")
if res.formsemestre.etat else "voir"} décisions""",
group="col_jury_link",
target=url_for(
@ -223,7 +229,8 @@ class RowJury(RowRecap):
self.add_cell(
col_id + "_code",
f"<div>{rcue.ue_1.acronyme}</div><div>{rcue.ue_2.acronyme}</div>",
dec_rcue.code_valide or "",
dec_rcue.code_valide or EMO_EMPTY_CODE_JURY,
raw_content=dec_rcue.code_valide or "",
group="rcue",
classes=["col_rcue_code", "recorded_code"],
column_classes={"col_rcue"},

View File

@ -79,6 +79,19 @@ class TableRecap(tb.Table):
ues = res.formsemestre.query_ues(with_sport=True) # avec bonus
ues_sans_bonus = [ue for ue in ues if ue.type != UE_SPORT]
if res.formsemestre.etuds_inscriptions: # table non vide
# Fixe l'ordre des groupes de colonnes communs:
groups = [
"rang",
"identite_court",
"identite_detail",
"partition",
"cursus",
]
if not res.formsemestre.block_moyenne_generale:
groups.append("col_moy_gen")
self.set_groups(groups)
for etudid in res.formsemestre.etuds_inscriptions:
etud = Identite.query.get(etudid)
row = self.row_class(self, etud)
@ -86,7 +99,6 @@ class TableRecap(tb.Table):
row.add_etud_cols()
row.add_moyennes_cols(ues_sans_bonus)
if res.formsemestre.etuds_inscriptions: # table non vide
self.add_partitions()
self.add_cursus()
self.add_admissions()
@ -199,28 +211,33 @@ class TableRecap(tb.Table):
col_id = f"moy_ue_{ue.id}"
row_ects.add_cell(col_id, None, ue.ects)
# la colonne où placer les valeurs agrégats
col_id = "moy_gen" if "moy_gen" in self.column_ids else "cursus"
col_group = "col_moy_gen" if "moy_gen" in self.column_ids else "cursus"
row_ects.add_cell(
"moy_gen",
col_id,
None,
sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT]),
group=col_group,
)
# --- MIN, MAX, MOY, APO
row_min.add_cell(
"moy_gen",
col_id,
None,
self.fmt_note(res.etud_moy_gen.min()),
# classes=["col_moy_gen"],
group=col_group,
)
row_max.add_cell(
"moy_gen",
col_id,
None,
self.fmt_note(res.etud_moy_gen.max()),
classes=["col_moy_gen"],
group=col_group,
)
row_moy.add_cell(
"moy_gen",
col_id,
None,
self.fmt_note(res.etud_moy_gen.mean()),
group=col_group,
)
for ue in ues:
@ -288,7 +305,6 @@ class TableRecap(tb.Table):
La table contient des rows avec la clé etudid.
Les colonnes ont la classe css "partition".
"""
self.insert_group("partition", after="identite_court")
self.group_titles["partition"] = "Partitions"
partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups(
self.res.formsemestre.id
@ -473,8 +489,7 @@ class TableRecap(tb.Table):
def add_cursus(self):
"""Ajoute colonne avec code cursus, eg 'S1 S2 S1'
pour tous les étduiants de la table"""
self.insert_group("cursus", before="col_ues_validables")
cid = "code_cursus"
cid = "cursus"
formation_code = self.res.formsemestre.formation.formation_code
for row in self.rows:
row.add_cell(
@ -591,6 +606,8 @@ class RowRecap(tb.Row):
classes=[note_class],
)
# Ajoute bulle sur titre du pied de table:
cell = table.foot_title_row.cells.get("moy_gen")
if cell:
table.foot_title_row.cells["moy_gen"].target_attrs["title"] = (
"Moyenne générale indicative"
if res.is_apc
@ -632,8 +649,6 @@ class RowRecap(tb.Row):
) = f"{self.nb_ues_validables}/{self.nb_ues_etud_parcours}"
if self.nb_ues_warning:
ue_valid_txt_html += " " + scu.EMO_WARNING
# place juste avant moy. gen.
table.insert_group("col_ues_validables", before="col_moy_gen")
cell_class = ""
if self.nb_ues_warning:
cell_class = "moy_ue_warning"
@ -709,11 +724,11 @@ class RowRecap(tb.Row):
if modimpl.module.module_type == scu.ModuleType.MALUS:
if val and not isinstance(val, str) and not np.isnan(val):
if val >= 0:
val_fmt_html = f"""<span class="red-arself-down"></span><span class="sp2l">+{
val_fmt_html = f"""<span class="sp2l">-{
val_fmt
}</span>"""
else:
val_fmt_html = f"""<span class="green-arrow-up"></span><span class="sp2l malus_negatif">-{
val_fmt_html = f"""<span class="sp2l malus_negatif">+{
table.fmt_note(-val)}</span>"""
else:
val_fmt = val_fmt_html = "" # inscrit à ce malus, mais sans note

View File

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