diff --git a/app/but/jury_but.py b/app/but/jury_but.py index 942a5aa7..1e861c9e 100644 --- a/app/but/jury_but.py +++ b/app/but/jury_but.py @@ -983,6 +983,10 @@ class DecisionsProposeesAnnee(DecisionsProposees): messages.append(f"L'UE {ue.acronyme} n'a pas décision (???)") return messages + def valide_diplome(self) -> bool: + "Vrai si l'étudiant à validé son diplôme" + return False # TODO XXX + def list_ue_parcour_etud( formsemestre: FormSemestre, etud: Identite, res: ResultatsSemestreBUT diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 32dd5a0f..551c4d3a 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -92,7 +92,12 @@ def pvjury_page_but(formsemestre_id: int, fmt="html"): def pvjury_table_but( - formsemestre: FormSemestre, etudids: list[int] = None, line_sep: str = "\n" + formsemestre: FormSemestre, + etudids: list[int] = None, + line_sep: str = "\n", + only_diplome=False, + anonymous=False, + with_paragraph_nom=False, ) -> tuple[list[dict], dict]: """Table avec résultats jury BUT pour PV. Si etudids est None, prend tous les étudiants inscrits. @@ -100,7 +105,7 @@ def pvjury_table_but( # remplace pour le BUT la fonction sco_pv_forms.pvjury_table annee_but = (formsemestre.semestre_id + 1) // 2 titles = { - "nom": "Nom", + "nom": "Code" if anonymous else "Nom", "cursus": "Cursus", "ects": "ECTS", "ues": "UE validées", @@ -127,8 +132,13 @@ def pvjury_table_but( continue except ScoValueError: deca = None + row = { - "nom": etud.etat_civil_pv(line_sep=line_sep), + "nom": etud.code_ine or etud.code_nip or etud.id + if anonymous # Mode anonyme: affiche INE ou sinon NIP, ou id + else etud.etat_civil_pv( + line_sep=line_sep, with_paragraph=with_paragraph_nom + ), "_nom_order": etud.sort_key, "_nom_target_attrs": f'class="etudinfo" id="{etud.id}"', "_nom_td_attrs": f'id="{etud.id}" class="etudinfo"', @@ -148,8 +158,8 @@ def pvjury_table_but( if deca else "", } - - rows.append(row) + if deca.valide_diplome() or not only_diplome: + rows.append(row) rows.sort(key=lambda x: x["_nom_order"]) return rows, titles diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 55a21158..6f0acda8 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -423,14 +423,21 @@ class Identite(db.Model): return situation - def etat_civil_pv(self, line_sep="\n") -> str: + def etat_civil_pv(self, with_paragraph=True, line_sep="\n") -> str: """Présentation, pour PV jury - M. Pierre Dupont - n° 12345678 - né(e) le 7/06/1974 - à Paris + Si with_paragraph (défaut): + M. Pierre Dupont + n° 12345678 + né(e) le 7/06/1974 + à Paris + Sinon: + M. Pierre Dupont """ - return f"""{self.nomprenom}{line_sep}n°{self.code_nip or ""}{line_sep}né{self.e} le {self.date_naissance.strftime("%d/%m/%Y") if self.date_naissance else ""}{line_sep}à {self.lieu_naissance or ""}""" + if with_paragraph: + return f"""{self.nomprenom}{line_sep}n°{self.code_nip or ""}{line_sep}né{self.e} le { + self.date_naissance.strftime("%d/%m/%Y") if self.date_naissance else ""}{ + line_sep}à {self.lieu_naissance or ""}""" + return self.nomprenom def photo_html(self, title=None, size="small") -> str: """HTML img tag for the photo, either in small size (h90) diff --git a/app/scodoc/sco_pv_pdf.py b/app/scodoc/sco_pv_pdf.py index c9473ba1..6c84deb9 100644 --- a/app/scodoc/sco_pv_pdf.py +++ b/app/scodoc/sco_pv_pdf.py @@ -232,7 +232,12 @@ def _pvjury_pdf_type( if formsemestre.formation.is_apc(): rows, titles = jury_but_pv.pvjury_table_but( - formsemestre, etudids=etudids, line_sep="
" + formsemestre, + etudids=etudids, + line_sep="
", + only_diplome=only_diplome, + anonymous=anonymous, + with_paragraph_nom=with_paragraph_nom, ) columns_ids = list(titles.keys()) a_diplome = codes_cursus.ADM in [row.get("diplome") for row in rows]