PV jury: indique démission en BUT (oubli) et nouvelle pref. pour signature de gauche

This commit is contained in:
Emmanuel Viennet 2024-09-23 22:52:21 +02:00
parent 0d5d6e7e3b
commit 851f64f38a
4 changed files with 61 additions and 16 deletions

View File

@ -198,7 +198,15 @@ def pvjury_table_but(
"niveaux": (
deca.descr_niveaux_validation(line_sep=line_sep) if deca else "-"
),
"decision_but": deca.code_valide if deca else "",
"decision_but": (
(
scu.ETATS_INSCRIPTION_SHORT.get(deca.inscription_etat)
if deca.inscription_etat != scu.INSCRIT
else deca.code_valide
)
if deca
else ""
),
"devenir": (
"Diplôme obtenu"
if has_diplome

View File

@ -1031,6 +1031,19 @@ class BasePreferences:
"category": "pvpdf",
},
),
(
"PV_SIGNATURE_LEFT",
{
"initvalue": "",
"title": "Texte signature PV gauche",
"explanation": """texte optionnel placé sous la table
du PV de jury, à gauche de la signature""",
"input_type": "textarea",
"rows": 1,
"cols": 64,
"category": "pvpdf",
},
),
(
"ChiefDeptName",
{

View File

@ -31,13 +31,8 @@ import io
import reportlab
from reportlab.lib.units import cm, mm
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.platypus import (
Paragraph,
Spacer,
PageBreak,
Table,
)
from reportlab.lib.enums import TA_JUSTIFY, TA_LEFT, TA_RIGHT
from reportlab.platypus import Paragraph, Spacer, PageBreak, Table, TableStyle
from reportlab.platypus.doctemplate import BaseDocTemplate
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import styles
@ -179,7 +174,7 @@ def _pvjury_pdf_type(
) -> tuple[list, bool]:
"""Objets platypus PDF récapitulant les décisions de jury
pour un type de jury (passage ou delivrance).
Ramene: liste d'onj platypus, et un boolen indiquant si au moins un étudiant est diplômé.
Ramene: liste d'obj platypus, et un booléen indiquant si au moins un étudiant est diplômé.
"""
from app.scodoc import sco_pv_forms
from app.but import jury_but_pv
@ -325,15 +320,39 @@ def _pvjury_pdf_type(
Table(table_cells, repeatRows=1, colWidths=widths, style=table_style)
)
# Signature du directeur
objects += sco_pdf.make_paras(
f"""<para spaceBefore="10mm" align="right">{
sco_preferences.get_preference("DirectorName", formsemestre.id) or ""
}, {
sco_preferences.get_preference("DirectorTitle", formsemestre.id) or ""
}</para>""",
# Table sous la table avec signatures
# Create paragraphs
left_para = sco_pdf.make_paras(
f"""<para align="left">{
sco_preferences.get_preference("PV_SIGNATURE_LEFT", formsemestre.id) or ""
}</para>""",
style,
)
# Signature du directeur
right_para = sco_pdf.make_paras(
f"""<para spaceBefore="10mm" align="right">{
sco_preferences.get_preference("DirectorName", formsemestre.id) or ""
}, {
sco_preferences.get_preference("DirectorTitle", formsemestre.id) or ""
}</para>""",
style,
)
# Create a table with two cells
data = [[left_para, right_para]]
# Create the table
table_signatures = Table(data)
# Apply table style to remove borders
table_signatures.setStyle(
TableStyle(
[
("BOX", (0, 0), (-1, -1), 0, "white"), # No border for the table
("INNERGRID", (0, 0), (-1, -1), 0, "white"), # No inner grid lines
("VALIGN", (0, 0), (-1, -1), "TOP"), # Align content to the top
]
)
)
objects.append(Spacer(0, 6 * mm))
objects.append(table_signatures)
# Légende des codes
codes = list(codes_cursus.CODES_EXPL.keys())

View File

@ -109,6 +109,11 @@ ETATS_INSCRIPTION = {
DEMISSION: "Démission",
DEF: "Défaillant",
}
ETATS_INSCRIPTION_SHORT = {
INSCRIT: "I",
DEMISSION: "DEM",
DEF: "DEF",
}
def convert_fr_date(