forked from ScoDoc/ScoDoc
table recap: densifie, libère footer, menu modules
This commit is contained in:
parent
553770f4ba
commit
4b160ef25e
@ -541,7 +541,9 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
row["_moy_gen_class"] = "col_moy_gen"
|
row["_moy_gen_class"] = "col_moy_gen"
|
||||||
# titre de la ligne:
|
# titre de la ligne:
|
||||||
row["prenom"] = row["nom_short"] = bottom_line.capitalize()
|
row["prenom"] = row["nom_short"] = bottom_line.capitalize()
|
||||||
row["_tr_class"] = bottom_line.lower()
|
row["_tr_class"] = bottom_line.lower() + (
|
||||||
|
(" " + row["_tr_class"]) if "_tr_class" in row else ""
|
||||||
|
)
|
||||||
footer_rows.append(row)
|
footer_rows.append(row)
|
||||||
titles_bot.update(titles)
|
titles_bot.update(titles)
|
||||||
footer_rows.append(titles_bot)
|
footer_rows.append(titles_bot)
|
||||||
@ -554,30 +556,29 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
|
|
||||||
def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict:
|
def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict:
|
||||||
"""Les informations à mettre en bas de la table: min, max, moy, ECTS"""
|
"""Les informations à mettre en bas de la table: min, max, moy, ECTS"""
|
||||||
bottom_infos = { # { key : row } avec key = min, max, moy, coef
|
row_min, row_max, row_moy, row_coef, row_ects = (
|
||||||
"min": {},
|
{"_tr_class": "bottom_info"},
|
||||||
"max": {},
|
{"_tr_class": "bottom_info"},
|
||||||
"moy": {},
|
{"_tr_class": "bottom_info"},
|
||||||
"coef": {},
|
{"_tr_class": "bottom_info"},
|
||||||
}
|
{"_tr_class": "bottom_info"},
|
||||||
|
)
|
||||||
# --- ECTS
|
# --- ECTS
|
||||||
row = {}
|
|
||||||
for ue in ues:
|
for ue in ues:
|
||||||
row[f"moy_ue_{ue.id}"] = ue.ects
|
row_ects[f"moy_ue_{ue.id}"] = ue.ects
|
||||||
row[f"_moy_ue_{ue.id}_class"] = "col_ue"
|
row_ects[f"_moy_ue_{ue.id}_class"] = "col_ue"
|
||||||
# style cases vides pour borders verticales
|
# style cases vides pour borders verticales
|
||||||
bottom_infos["coef"][f"moy_ue_{ue.id}"] = ""
|
row_coef[f"moy_ue_{ue.id}"] = ""
|
||||||
bottom_infos["coef"][f"_moy_ue_{ue.id}_class"] = "col_ue"
|
row_coef[f"_moy_ue_{ue.id}_class"] = "col_ue"
|
||||||
row["moy_gen"] = sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT])
|
row_ects["moy_gen"] = sum([ue.ects or 0 for ue in ues if ue.type != UE_SPORT])
|
||||||
row["_moy_gen_class"] = "col_moy_gen"
|
row_ects["_moy_gen_class"] = "col_moy_gen"
|
||||||
bottom_infos["ects"] = row
|
|
||||||
|
|
||||||
# --- MIN, MAX, MOY
|
# --- MIN, MAX, MOY
|
||||||
row_min, row_max, row_moy = {}, {}, {}
|
|
||||||
row_min["moy_gen"] = fmt_note(self.etud_moy_gen.min())
|
row_min["moy_gen"] = fmt_note(self.etud_moy_gen.min())
|
||||||
row_max["moy_gen"] = fmt_note(self.etud_moy_gen.max())
|
row_max["moy_gen"] = fmt_note(self.etud_moy_gen.max())
|
||||||
row_moy["moy_gen"] = fmt_note(self.etud_moy_gen.mean())
|
row_moy["moy_gen"] = fmt_note(self.etud_moy_gen.mean())
|
||||||
for ue in [ue for ue in ues if ue.type != UE_SPORT]:
|
for ue in ues:
|
||||||
col_id = f"moy_ue_{ue.id}"
|
col_id = f"moy_ue_{ue.id}"
|
||||||
row_min[col_id] = fmt_note(self.etud_moy_ue[ue.id].min())
|
row_min[col_id] = fmt_note(self.etud_moy_ue[ue.id].min())
|
||||||
row_max[col_id] = fmt_note(self.etud_moy_ue[ue.id].max())
|
row_max[col_id] = fmt_note(self.etud_moy_ue[ue.id].max())
|
||||||
@ -593,16 +594,19 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
coef = self.modimpl_coefs_df[modimpl.id][ue.id]
|
coef = self.modimpl_coefs_df[modimpl.id][ue.id]
|
||||||
else:
|
else:
|
||||||
coef = modimpl.module.coefficient or 0
|
coef = modimpl.module.coefficient or 0
|
||||||
bottom_infos["coef"][col_id] = fmt_note(coef)
|
row_coef[col_id] = fmt_note(coef)
|
||||||
notes = self.modimpl_notes(modimpl.id, ue.id)
|
notes = self.modimpl_notes(modimpl.id, ue.id)
|
||||||
row_min[col_id] = fmt_note(np.nanmin(notes))
|
row_min[col_id] = fmt_note(np.nanmin(notes))
|
||||||
row_max[col_id] = fmt_note(np.nanmax(notes))
|
row_max[col_id] = fmt_note(np.nanmax(notes))
|
||||||
row_moy[col_id] = fmt_note(np.nanmean(notes))
|
row_moy[col_id] = fmt_note(np.nanmean(notes))
|
||||||
|
|
||||||
bottom_infos["min"] = row_min
|
return { # { key : row } avec key = min, max, moy, coef
|
||||||
bottom_infos["max"] = row_max
|
"min": row_min,
|
||||||
bottom_infos["moy"] = row_moy
|
"max": row_max,
|
||||||
return bottom_infos
|
"moy": row_moy,
|
||||||
|
"coef": row_coef,
|
||||||
|
"ects": row_ects,
|
||||||
|
}
|
||||||
|
|
||||||
def _recap_etud_groups_infos(self, etudid: int, row: dict, titles: dict):
|
def _recap_etud_groups_infos(self, etudid: int, row: dict, titles: dict):
|
||||||
"""Table recap: ajoute à row les colonnes sur les groupes pour cet etud"""
|
"""Table recap: ajoute à row les colonnes sur les groupes pour cet etud"""
|
||||||
|
@ -1015,9 +1015,10 @@ def _gen_cell(key: str, row: dict, elt="td"):
|
|||||||
attrs += f' data-order="{order}"'
|
attrs += f' data-order="{order}"'
|
||||||
content = row.get(key, "")
|
content = row.get(key, "")
|
||||||
target = row.get(f"_{key}_target")
|
target = row.get(f"_{key}_target")
|
||||||
if content or target: # avec lien
|
target_attrs = row.get(f"_{key}_target_attrs", "")
|
||||||
|
if target or target_attrs: # avec lien
|
||||||
href = f'href="{target}"' if target else ""
|
href = f'href="{target}"' if target else ""
|
||||||
content = f'<a {href} {row.get(f"_{key}_target_attrs", "")}>{content}</a>'
|
content = f"<a {href} {target_attrs}>{content}</a>"
|
||||||
return f"<{elt} {attrs}>{content}</{elt}>"
|
return f"<{elt} {attrs}>{content}</{elt}>"
|
||||||
|
|
||||||
|
|
||||||
@ -1039,7 +1040,9 @@ def gen_formsemestre_recapcomplet_html(
|
|||||||
'<div class="table_recap"><div class="message">aucun étudiant !</div></div>',
|
'<div class="table_recap"><div class="message">aucun étudiant !</div></div>',
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
H = ['<div class="table_recap"><table class="table_recap">']
|
H = [
|
||||||
|
f"""<div class="table_recap"><table class="table_recap {'apc' if formsemestre.formation.is_apc() else ''}">"""
|
||||||
|
]
|
||||||
# header
|
# header
|
||||||
H.append(
|
H.append(
|
||||||
f"""
|
f"""
|
||||||
|
@ -3155,7 +3155,14 @@ table.table_recap tr.selected td:first-child {
|
|||||||
table.table_recap tr.selected td:last-child {
|
table.table_recap tr.selected td:last-child {
|
||||||
border-right: 1px solid rgb(248, 0, 33);
|
border-right: 1px solid rgb(248, 0, 33);
|
||||||
}
|
}
|
||||||
|
table.table_recap tbody td {
|
||||||
|
padding-top: 4px !important;
|
||||||
|
padding-bottom: 4px !important;
|
||||||
|
}
|
||||||
|
table.table_recap tbody td:hover {
|
||||||
|
color: rgb(163, 0, 0);
|
||||||
|
text-decoration: dashed underline;
|
||||||
|
}
|
||||||
table.table_recap .identite_court {
|
table.table_recap .identite_court {
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -3169,6 +3176,7 @@ table.table_recap .col_ue, table.table_recap .col_moy_gen, table.table_recap .gr
|
|||||||
}
|
}
|
||||||
table.table_recap .group {
|
table.table_recap .group {
|
||||||
border-left: 1px dashed rgb(160, 160, 160);
|
border-left: 1px dashed rgb(160, 160, 160);
|
||||||
|
white-space:nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.table_recap tbody tr td a:hover {
|
table.table_recap tbody tr td a:hover {
|
||||||
|
@ -1,6 +1,49 @@
|
|||||||
// Tableau recap notes
|
// Tableau recap notes
|
||||||
$(function () {
|
$(function () {
|
||||||
$(function () {
|
$(function () {
|
||||||
|
// Les boutons dépendent du mode BUT ou classique:
|
||||||
|
let buttons = [
|
||||||
|
{
|
||||||
|
name: "toggle_ident",
|
||||||
|
text: "Civ/Nom/Prénom",
|
||||||
|
action: function (e, dt, node, config) {
|
||||||
|
let visible = dt.columns(".identite_detail").visible()[0];
|
||||||
|
dt.columns(".identite_detail").visible(!visible);
|
||||||
|
dt.columns(".identite_court").visible(visible);
|
||||||
|
dt.buttons('toggle_ident:name').text(visible ? "Civ/Nom/Prénom" : "Nom");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
$('table.table_recap').hasClass("apc") ?
|
||||||
|
{
|
||||||
|
name: "toggle_res",
|
||||||
|
text: "Cacher les ressources",
|
||||||
|
action: function (e, dt, node, config) {
|
||||||
|
let visible = dt.columns(".col_res").visible()[0];
|
||||||
|
dt.columns(".col_res").visible(!visible);
|
||||||
|
dt.buttons('toggle_res:name').text(visible ? "Montrer les ressources" : "Cacher les ressources");
|
||||||
|
}
|
||||||
|
} : {
|
||||||
|
name: "toggle_mod",
|
||||||
|
text: "Cacher les modules",
|
||||||
|
action: function (e, dt, node, config) {
|
||||||
|
let visible = dt.columns(".col_mod").visible()[0];
|
||||||
|
dt.columns(".col_mod").visible(!visible);
|
||||||
|
dt.buttons('toggle_mod:name').text(visible ? "Montrer les modules" : "Cacher les modules");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if ($('table.table_recap').hasClass("apc")) {
|
||||||
|
buttons.push({
|
||||||
|
name: "toggle_sae",
|
||||||
|
text: "Cacher les SAÉs",
|
||||||
|
action: function (e, dt, node, config) {
|
||||||
|
let visible = dt.columns(".col_sae").visible()[0];
|
||||||
|
dt.columns(".col_sae").visible(!visible);
|
||||||
|
dt.buttons('toggle_sae:name').text(visible ? "Montrer les SAÉs" : "Cacher les SAÉs");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
$('table.table_recap').DataTable(
|
$('table.table_recap').DataTable(
|
||||||
{
|
{
|
||||||
paging: false,
|
paging: false,
|
||||||
@ -9,7 +52,7 @@ $(function () {
|
|||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
fixedHeader: {
|
fixedHeader: {
|
||||||
header: true,
|
header: true,
|
||||||
footer: true
|
footer: false
|
||||||
},
|
},
|
||||||
orderCellsTop: true, // cellules ligne 1 pour tri
|
orderCellsTop: true, // cellules ligne 1 pour tri
|
||||||
aaSorting: [], // Prevent initial sorting
|
aaSorting: [], // Prevent initial sorting
|
||||||
@ -22,42 +65,12 @@ $(function () {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
dom: 'Bfrtip',
|
dom: 'Bfrtip',
|
||||||
buttons: [
|
buttons: ['copy', 'excel', 'pdf',
|
||||||
'copy', 'excel', 'pdf',
|
|
||||||
{
|
{
|
||||||
extend: 'collection',
|
extend: 'collection',
|
||||||
text: 'Réglages affichage',
|
text: 'Réglages affichage',
|
||||||
autoClose: true,
|
autoClose: true,
|
||||||
buttons: [
|
buttons: buttons,
|
||||||
{
|
|
||||||
name: "toggle_ident",
|
|
||||||
text: "Civ/Nom/Prénom",
|
|
||||||
action: function (e, dt, node, config) {
|
|
||||||
let visible = dt.columns(".identite_detail").visible()[0];
|
|
||||||
dt.columns(".identite_detail").visible(!visible);
|
|
||||||
dt.columns(".identite_court").visible(visible);
|
|
||||||
dt.buttons('toggle_ident:name').text(visible ? "Civ/Nom/Prénom" : "Nom");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "toggle_res",
|
|
||||||
text: "Cacher les ressources",
|
|
||||||
action: function (e, dt, node, config) {
|
|
||||||
let visible = dt.columns(".col_res").visible()[0];
|
|
||||||
dt.columns(".col_res").visible(!visible);
|
|
||||||
dt.buttons('toggle_res:name').text(visible ? "Montrer les ressources" : "Cacher les ressources");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "toggle_sae",
|
|
||||||
text: "Cacher les SAÉs",
|
|
||||||
action: function (e, dt, node, config) {
|
|
||||||
let visible = dt.columns(".col_sae").visible()[0];
|
|
||||||
dt.columns(".col_sae").visible(!visible);
|
|
||||||
dt.buttons('toggle_sae:name').text(visible ? "Montrer les SAÉs" : "Cacher les SAÉs");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user