From 99a9b236261ad2f2db8b7d368c8d8302cc868f90 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 25 Dec 2022 10:47:58 -0300 Subject: [PATCH] =?UTF-8?q?Ajout=20colonne=20cursus=20sur=20tableaux=20rec?= =?UTF-8?q?ap=20BUT.=20Saisie=20jury=20sur=20sem.=20impairs=20avec=20table?= =?UTF-8?q?au=20r=C3=A9duit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/jury_but_recap.py | 5 ++++- app/but/jury_but_view.py | 4 ++-- app/comp/res_common.py | 27 ++++++++++++++++++++++++--- app/scodoc/sco_report.py | 5 +++++ app/static/css/jury_but.css | 4 ++++ app/views/notes.py | 2 +- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/app/but/jury_but_recap.py b/app/but/jury_but_recap.py index d9dbd92a..95e32855 100644 --- a/app/but/jury_but_recap.py +++ b/app/but/jury_but_recap.py @@ -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"]) diff --git a/app/but/jury_but_view.py b/app/but/jury_but_view.py index 9d3b9d2a..6c1fda17 100644 --- a/app/but/jury_but_view.py +++ b/app/but/jury_but_view.py @@ -375,9 +375,9 @@ def jury_but_semestriel( erase_span = f"""effacer décisions""" + etudid=etud.id, only_one_sem=1)}" class="stdlink">effacer les décisions enregistrées""" 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""" diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 567c658d..3c06451f 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -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 diff --git a/app/scodoc/sco_report.py b/app/scodoc/sco_report.py index 725337ae..1fe2c17c 100644 --- a/app/scodoc/sco_report.py +++ b/app/scodoc/sco_report.py @@ -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...) diff --git a/app/static/css/jury_but.css b/app/static/css/jury_but.css index d8e84425..955aed94 100644 --- a/app/static/css/jury_but.css +++ b/app/static/css/jury_but.css @@ -14,6 +14,10 @@ font-weight: bold; } +.jury_but h3 { + margin-top: 0px; +} + .but_annee { margin-left: 32px; display: inline-grid; diff --git a/app/views/notes.py b/app/views/notes.py index 27521616..7d1d3901 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -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 )