Jury BUT: stats jury, #425

This commit is contained in:
Emmanuel Viennet 2022-12-25 17:43:22 -03:00
parent 0b72762e43
commit 57a20760f4
3 changed files with 61 additions and 4 deletions

View File

@ -204,6 +204,7 @@ class DecisionsProposeesAnnee(DecisionsProposees):
etud: Identite,
formsemestre: FormSemestre,
):
assert formsemestre.formation.is_apc()
super().__init__(etud=etud)
self.formsemestre = formsemestre
"le formsemestre utilisé pour construire ce deca"

View File

@ -7,6 +7,7 @@
"""Jury BUT: table recap annuelle et liens saisie
"""
import collections
import time
import numpy as np
from flask import g, url_for
@ -71,7 +72,7 @@ def formsemestre_saisie_jury_but(
"""
)
rows, titles, column_ids = get_jury_but_table(
rows, titles, column_ids, jury_stats = get_jury_but_table(
formsemestre2, read_only=read_only, mode=mode
)
if not rows:
@ -153,6 +154,28 @@ def formsemestre_saisie_jury_but(
f"""
</div>
<div class="jury_stats">
<div>Nb d'étudiants avec décision annuelle:
{sum(jury_stats["codes_annuels"].values())} / {jury_stats["nb_etuds"]}
</div>
<div><b>Codes annuels octroyés:</b></div>
<table class="jury_stats_codes">
"""
)
for code in sorted(jury_stats["codes_annuels"].keys()):
H.append(
f"""<tr>
<td>{code}</td>
<td style="text-align:right">{jury_stats["codes_annuels"][code]}</td>
<td style="text-align:right">{
(100*jury_stats["codes_annuels"][code] / jury_stats["nb_etuds"]):2.1f}%
</td>
</tr>"""
)
H.append(
f"""
</table>
</div>
{html_sco_header.sco_footer()}
"""
)
@ -377,10 +400,17 @@ class RowCollector:
def get_jury_but_table(
formsemestre2: FormSemestre, read_only: bool = False, mode="jury", with_links=True
) -> tuple[list[dict], list[str], list[str]]:
"""Construit la table des résultats annuels pour le jury BUT"""
) -> tuple[list[dict], list[str], list[str], dict]:
"""Construit la table des résultats annuels pour le jury BUT
=> rows_dict, titles, column_ids, jury_stats
jury_stats est un dict donnant des comptages sur le jury.
"""
res2: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre2)
titles = {} # column_id : title
jury_stats = {
"nb_etuds": len(formsemestre2.etuds_inscriptions),
"codes_annuels": collections.Counter(),
}
column_classes = {}
rows = []
for etudid in formsemestre2.etuds_inscriptions:
@ -417,6 +447,8 @@ def get_jury_but_table(
f"""{deca.code_valide or ''}""",
"col_code_annee",
)
if deca.code_valide:
jury_stats["codes_annuels"][deca.code_valide] += 1
# --- Le lien de saisie
if mode != "recap" and with_links:
row.add_cell(
@ -446,7 +478,7 @@ def get_jury_but_table(
column_ids = [title for title in titles if not title.startswith("_")]
column_ids.sort(key=lambda col_id: titles.get("_" + col_id + "_col_order", 1000))
rows_dict.sort(key=lambda row: row["_nom_disp_order"])
return rows_dict, titles, column_ids
return rows_dict, titles, column_ids, jury_stats
def get_jury_but_results(formsemestre: FormSemestre) -> list[dict]:

View File

@ -4171,6 +4171,30 @@ div.table_jury_but_links {
margin-bottom: 16px;
}
/* ------------- Tableau stats jury BUT -------- */
table.jury_stats_codes {
margin-top: 8px;
margin-left: 42px;
border: 3px solid #000000;
text-align: left;
border-collapse: collapse;
}
table.jury_stats_codes td {
margin-right: 12px;
border-top: 1px solid #000000;
padding: 5px 8px;
}
div.jury_stats {
background-color: #c7f6c7;
border-radius: 12px;
border: 1px solid black;
padding: 8px;
width: fit-content;
}
/* ------------- Tableau etat evals ------------ */
div.evaluations_recap table.evaluations_recap {