1
0
forked from ScoDoc/ScoDoc

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 { div.table_recap table.table_recap {
width: auto; width: auto;
/* font-family: Consolas, monaco, monospace; */
} }
table.table_recap tr.selected td { 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"); let mode_jury_but_bilan = $('table.table_recap').hasClass("table_jury_but_bilan");
if (mode_jury_but_bilan) { if (mode_jury_but_bilan) {
// table bilan décisions: cache les notes // 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: // 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) { function update_buttons_labels(dt) {
console.log("update_buttons_labels"); console.log("update_buttons_labels");
dt.buttons('toggle_ident:name').text(dt.columns(".identite_detail").visible()[0] ? "Nom seul" : "Civ/Nom/Prénom"); 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.scodoc import sco_utils as scu
from app.tables.recap import RowRecap, TableRecap from app.tables.recap import RowRecap, TableRecap
EMO_EMPTY_CODE_JURY = "🏮" # "🍽" "🚨"
class TableJury(TableRecap): class TableJury(TableRecap):
"""Cette table recap reprend les colonnes du tableau recap, sauf les évaluations, """Cette table recap reprend les colonnes du tableau recap, sauf les évaluations,
@ -100,7 +102,11 @@ class TableJury(TableRecap):
else: else:
jury_code_sem = "" jury_code_sem = ""
row.add_cell( 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[ self.foot_title_row.cells["jury_code_sem"].target_attrs[
"title" "title"
@ -109,7 +115,7 @@ class TableJury(TableRecap):
row.add_cell( row.add_cell(
"jury_link", "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""", if res.formsemestre.etat else "voir"} décisions""",
group="col_jury_link", group="col_jury_link",
target=url_for( target=url_for(
@ -223,7 +229,8 @@ class RowJury(RowRecap):
self.add_cell( self.add_cell(
col_id + "_code", col_id + "_code",
f"<div>{rcue.ue_1.acronyme}</div><div>{rcue.ue_2.acronyme}</div>", 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", group="rcue",
classes=["col_rcue_code", "recorded_code"], classes=["col_rcue_code", "recorded_code"],
column_classes={"col_rcue"}, column_classes={"col_rcue"},

View File

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

View File

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