1
0
forked from ScoDoc/ScoDoc

Ajout colonne cursus sur tableaux recap BUT. Saisie jury sur sem. impairs avec tableau réduit.

This commit is contained in:
Emmanuel Viennet 2022-12-25 10:47:58 -03:00
parent 886d312772
commit 99a9b23626
6 changed files with 40 additions and 7 deletions

View File

@ -439,7 +439,10 @@ def get_jury_but_table(
rows.append(row)
rows_dict = [row.get_row_dict() for row in rows]
if len(rows_dict) > 0:
res2.recap_add_partitions(rows_dict, titles, col_idx=row.last_etud_cell_idx + 1)
col_idx = res2.recap_add_partitions(
rows_dict, titles, col_idx=row.last_etud_cell_idx + 1
)
res2.recap_add_cursus(rows_dict, titles, col_idx=col_idx + 1)
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"])

View File

@ -375,9 +375,9 @@ def jury_but_semestriel(
erase_span = f"""<a href="{
url_for("notes.formsemestre_jury_but_erase",
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id,
etudid=etud.id, only_one_sem=1)}" class="stdlink">effacer décisions</a>"""
etudid=etud.id, only_one_sem=1)}" class="stdlink">effacer les décisions enregistrées</a>"""
else:
erase_span = "aucune décision enregistrée pour ce semestre"
erase_span = "Cet étudiant n'a aucune décision enregistrée pour ce semestre."
H.append(
f"""

View File

@ -704,7 +704,7 @@ class ResultatsSemestre(ResultatsCache):
else:
jury_code_sem = ""
else:
# formations classiqes: code semestre
# formations classiques: code semestre
dec_sem = self.validations.decisions_jury.get(etudid)
jury_code_sem = dec_sem["code"] if dec_sem else ""
idx = add_cell(
@ -728,7 +728,8 @@ class ResultatsSemestre(ResultatsCache):
)
rows.append(row)
self.recap_add_partitions(rows, titles)
col_idx = self.recap_add_partitions(rows, titles)
self.recap_add_cursus(rows, titles, col_idx=col_idx + 1)
self._recap_add_admissions(rows, titles)
# tri par rang croissant
@ -899,10 +900,29 @@ class ResultatsSemestre(ResultatsCache):
else:
row[f"_{cid}_class"] = "admission"
def recap_add_partitions(self, rows: list[dict], titles: dict, col_idx: int = None):
def recap_add_cursus(self, rows: list[dict], titles: dict, col_idx: int = None):
"""Ajoute colonne avec code cursus, eg 'S1 S2 S1'"""
cid = "code_cursus"
titles[cid] = "Cursus"
titles[f"_{cid}_col_order"] = col_idx
formation_code = self.formsemestre.formation.formation_code
for row in rows:
etud = Identite.query.get(row["etudid"])
row[cid] = " ".join(
[
f"S{ins.formsemestre.semestre_id}"
for ins in reversed(etud.inscriptions())
if ins.formsemestre.formation.formation_code == formation_code
]
)
def recap_add_partitions(
self, rows: list[dict], titles: dict, col_idx: int = None
) -> int:
"""Ajoute les colonnes indiquant les groupes
rows est une liste de dict avec une clé "etudid"
Les colonnes ont la classe css "partition"
Renvoie l'indice de la dernière colonne utilisée
"""
partitions, partitions_etud_groups = sco_groups.get_formsemestre_groups(
self.formsemestre.id
@ -951,6 +971,7 @@ class ResultatsSemestre(ResultatsCache):
row[rg_cid] = rang.get(row["etudid"], "")
first_partition = False
return col_order
def _recap_add_evaluations(
self, rows: list[dict], titles: dict, bottom_infos: dict

View File

@ -1010,6 +1010,11 @@ def get_codeparcoursetud(etud, prefix="", separator=""):
12R pour un etudiant en S1, S2 réorienté en fin de S2
Construit aussi un dict: { semestre_id : decision_jury | None }
"""
# Nota: approche plus moderne:
# ' '.join([ f"S{ins.formsemestre.semestre_id}"
# for ins in reversed(etud.inscriptions())
# if ins.formsemestre.formation.formation_code == XXX ])
#
p = []
decisions_jury = {}
# élimine les semestres spéciaux sans parcours (LP...)

View File

@ -14,6 +14,10 @@
font-weight: bold;
}
.jury_but h3 {
margin-top: 0px;
}
.but_annee {
margin-left: 32px;
display: inline-grid;

View File

@ -2716,7 +2716,7 @@ def formsemestre_saisie_jury(formsemestre_id: int, selected_etudid: int = None):
"""
read_only = not sco_permissions_check.can_validate_sem(formsemestre_id)
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
if formsemestre.formation.is_apc(): # and formsemestre.semestre_id % 2 == 0:
if formsemestre.formation.is_apc() and formsemestre.semestre_id % 2 == 0:
return jury_but_recap.formsemestre_saisie_jury_but(
formsemestre, read_only, selected_etudid=selected_etudid
)