1
0
forked from ScoDoc/ScoDoc

PV BUUT: options sans détail identité, anonyme et seulement diplômés

This commit is contained in:
Emmanuel Viennet 2023-02-21 02:30:48 +01:00
parent 7a7c2f1778
commit 21714bae59
4 changed files with 38 additions and 12 deletions

View File

@ -983,6 +983,10 @@ class DecisionsProposeesAnnee(DecisionsProposees):
messages.append(f"L'UE {ue.acronyme} n'a pas décision (???)") messages.append(f"L'UE {ue.acronyme} n'a pas décision (???)")
return messages return messages
def valide_diplome(self) -> bool:
"Vrai si l'étudiant à validé son diplôme"
return False # TODO XXX
def list_ue_parcour_etud( def list_ue_parcour_etud(
formsemestre: FormSemestre, etud: Identite, res: ResultatsSemestreBUT formsemestre: FormSemestre, etud: Identite, res: ResultatsSemestreBUT

View File

@ -92,7 +92,12 @@ def pvjury_page_but(formsemestre_id: int, fmt="html"):
def pvjury_table_but( 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]: ) -> tuple[list[dict], dict]:
"""Table avec résultats jury BUT pour PV. """Table avec résultats jury BUT pour PV.
Si etudids est None, prend tous les étudiants inscrits. 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 # remplace pour le BUT la fonction sco_pv_forms.pvjury_table
annee_but = (formsemestre.semestre_id + 1) // 2 annee_but = (formsemestre.semestre_id + 1) // 2
titles = { titles = {
"nom": "Nom", "nom": "Code" if anonymous else "Nom",
"cursus": "Cursus", "cursus": "Cursus",
"ects": "ECTS", "ects": "ECTS",
"ues": "UE validées", "ues": "UE validées",
@ -127,8 +132,13 @@ def pvjury_table_but(
continue continue
except ScoValueError: except ScoValueError:
deca = None deca = None
row = { 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_order": etud.sort_key,
"_nom_target_attrs": f'class="etudinfo" id="{etud.id}"', "_nom_target_attrs": f'class="etudinfo" id="{etud.id}"',
"_nom_td_attrs": f'id="{etud.id}" class="etudinfo"', "_nom_td_attrs": f'id="{etud.id}" class="etudinfo"',
@ -148,8 +158,8 @@ def pvjury_table_but(
if deca if deca
else "", else "",
} }
if deca.valide_diplome() or not only_diplome:
rows.append(row) rows.append(row)
rows.sort(key=lambda x: x["_nom_order"]) rows.sort(key=lambda x: x["_nom_order"])
return rows, titles return rows, titles

View File

@ -419,14 +419,21 @@ class Identite(db.Model):
return situation 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 """Présentation, pour PV jury
M. Pierre Dupont Si with_paragraph (défaut):
n° 12345678 M. Pierre Dupont
(e) le 7/06/1974 n° 12345678
à Paris (e) le 7/06/1974
à Paris
Sinon:
M. Pierre Dupont
""" """
return f"""{self.nomprenom}{line_sep}{self.code_nip or ""}{line_sep}{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}{self.code_nip or ""}{line_sep}{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: def photo_html(self, title=None, size="small") -> str:
"""HTML img tag for the photo, either in small size (h90) """HTML img tag for the photo, either in small size (h90)

View File

@ -232,7 +232,12 @@ def _pvjury_pdf_type(
if formsemestre.formation.is_apc(): if formsemestre.formation.is_apc():
rows, titles = jury_but_pv.pvjury_table_but( rows, titles = jury_but_pv.pvjury_table_but(
formsemestre, etudids=etudids, line_sep="<br/>" formsemestre,
etudids=etudids,
line_sep="<br/>",
only_diplome=only_diplome,
anonymous=anonymous,
with_paragraph_nom=with_paragraph_nom,
) )
columns_ids = list(titles.keys()) columns_ids = list(titles.keys())
a_diplome = codes_cursus.ADM in [row.get("diplome") for row in rows] a_diplome = codes_cursus.ADM in [row.get("diplome") for row in rows]