Jury BUT: stats jury, #425

This commit is contained in:
Emmanuel Viennet 2022-12-25 17:43:22 -03:00 committed by iziram
parent c5b2df379e
commit bdefa111a7
3 changed files with 61 additions and 4 deletions

View File

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

View File

@ -7,6 +7,7 @@
"""Jury BUT: table recap annuelle et liens saisie """Jury BUT: table recap annuelle et liens saisie
""" """
import collections
import time import time
import numpy as np import numpy as np
from flask import g, url_for 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 formsemestre2, read_only=read_only, mode=mode
) )
if not rows: if not rows:
@ -153,6 +154,28 @@ def formsemestre_saisie_jury_but(
f""" f"""
</div> </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()} {html_sco_header.sco_footer()}
""" """
) )
@ -377,10 +400,17 @@ class RowCollector:
def get_jury_but_table( def get_jury_but_table(
formsemestre2: FormSemestre, read_only: bool = False, mode="jury", with_links=True formsemestre2: FormSemestre, read_only: bool = False, mode="jury", with_links=True
) -> tuple[list[dict], list[str], list[str]]: ) -> tuple[list[dict], list[str], list[str], dict]:
"""Construit la table des résultats annuels pour le jury BUT""" """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) res2: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre2)
titles = {} # column_id : title titles = {} # column_id : title
jury_stats = {
"nb_etuds": len(formsemestre2.etuds_inscriptions),
"codes_annuels": collections.Counter(),
}
column_classes = {} column_classes = {}
rows = [] rows = []
for etudid in formsemestre2.etuds_inscriptions: for etudid in formsemestre2.etuds_inscriptions:
@ -417,6 +447,8 @@ def get_jury_but_table(
f"""{deca.code_valide or ''}""", f"""{deca.code_valide or ''}""",
"col_code_annee", "col_code_annee",
) )
if deca.code_valide:
jury_stats["codes_annuels"][deca.code_valide] += 1
# --- Le lien de saisie # --- Le lien de saisie
if mode != "recap" and with_links: if mode != "recap" and with_links:
row.add_cell( 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 = [title for title in titles if not title.startswith("_")]
column_ids.sort(key=lambda col_id: titles.get("_" + col_id + "_col_order", 1000)) column_ids.sort(key=lambda col_id: titles.get("_" + col_id + "_col_order", 1000))
rows_dict.sort(key=lambda row: row["_nom_disp_order"]) 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]: def get_jury_but_results(formsemestre: FormSemestre) -> list[dict]:

View File

@ -4171,6 +4171,30 @@ div.table_jury_but_links {
margin-bottom: 16px; 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 ------------ */ /* ------------- Tableau etat evals ------------ */
div.evaluations_recap table.evaluations_recap { div.evaluations_recap table.evaluations_recap {