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 committed by iziram
parent 1e0645fd14
commit a9b809655b
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 (???)")
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

View File

@ -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

View File

@ -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
(e) le 7/06/1974
à Paris
Si with_paragraph (défaut):
M. Pierre Dupont
n° 12345678
(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:
"""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():
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())
a_diplome = codes_cursus.ADM in [row.get("diplome") for row in rows]