DUT après jury BUT: ajout sur bulletins et PVs. WIP #577

This commit is contained in:
Emmanuel Viennet 2024-07-07 22:07:27 +02:00
parent b14c3938b7
commit e63cdba1f6
9 changed files with 70 additions and 16 deletions

View File

@ -576,7 +576,6 @@ class BulletinBUT:
show_uevalid=self.prefs["bul_show_uevalid"],
show_mention=self.prefs["bul_show_mention"],
)
d.update(infos)
# --- Rangs
d["rang_nt"] = (

View File

@ -39,6 +39,7 @@ from app.scodoc.codes_cursus import UE_STANDARD
from app.scodoc.sco_exceptions import ScoNoReferentielCompetences, ScoValueError
from app.scodoc.sco_logos import find_logo
from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_pv_lettres_inviduelles import add_dut120_infos
import app.scodoc.sco_utils as scu
from app.views import notes_bp as bp
from app.views import ScoData
@ -67,7 +68,6 @@ def bulletin_but(formsemestre_id: int, etudid: int = None, fmt="html"):
raise ScoValueError("formation non BUT")
args = _build_bulletin_but_infos(etud, formsemestre, fmt=fmt)
if fmt == "pdf":
filename = scu.bul_filename(formsemestre, etud, prefix="bul-but")
bul_pdf = bulletin_but_court_pdf.make_bulletin_but_court_pdf(args)
@ -153,4 +153,5 @@ def _build_bulletin_but_infos(
if ue.type == UE_STANDARD and ue.acronyme in ue_acronyms
],
}
add_dut120_infos(formsemestre, etud.id, args)
return args

View File

@ -97,6 +97,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
tuple[int, str], ScolarFormSemestreValidation
] = None,
ues_acronyms: list[str] = None,
diplome_dut120: bool = False,
diplome_dut120_descr: str = "",
):
super().__init__(bul, authuser=current_user, filigranne=filigranne)
self.bul = bul
@ -110,7 +112,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
self.title = title
self.ue_validation_by_niveau = ue_validation_by_niveau
self.ues_acronyms = ues_acronyms # sans UEs sport
self.diplome_dut120 = diplome_dut120
self.diplome_dut120_descr = diplome_dut120_descr
self.nb_ues = len(self.ues_acronyms)
# Styles PDF
self.style_base = styles.ParagraphStyle("style_base")
@ -243,13 +246,17 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
)
table_abs_ues.hAlign = "RIGHT"
# Ligne (en bas) avec table cursus et boite jury
# table_content = [self.table_cursus_but()]
# if self.prefs["bul_show_decision"]:
# table_content.append([Spacer(1, 8 * mm), self.boite_decisions_jury()])
table_content = [self.table_cursus_but()]
table_content.append(
[Spacer(1, 8 * mm), self.boite_decisions_jury()]
if self.prefs["bul_show_decision"]
else []
)
table_cursus_jury = Table(
[
[
self.table_cursus_but(),
[Spacer(1, 8 * mm), self.boite_decisions_jury()],
]
],
[table_content],
colWidths=(self.width_page_avail - 84 * mm, 84 * mm),
style=style_table_2cols,
)
@ -533,6 +540,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
<br/>
{self.bul["diplomation"]}
"""
if self.diplome_dut120_descr:
txt += f"""<br/>{self.diplome_dut120_descr}."""
if self.bul["semestre"].get("autorisation_inscription", None):
txt += (

View File

@ -13,6 +13,7 @@ from openpyxl.styles import Alignment
from app import log
from app.but import jury_but
from app.but.cursus_but import but_ects_valides
from app.models.but_validations import ValidationDUT120
from app.models.etudiants import Identite
from app.models.formsemestre import FormSemestre
from app.scodoc.gen_tables import GenTable
@ -156,6 +157,13 @@ def pvjury_table_but(
ects_but_valides = but_ects_valides(etud, referentiel_competence_id)
has_diplome = deca.valide_diplome()
diplome_lst = ["ADM"] if has_diplome else []
validation_dut120 = ValidationDUT120.query.filter_by(
etudid=etudid, formsemestre_id=formsemestre.id
).first()
if validation_dut120:
diplome_lst.append("Diplôme de DUT validé.")
diplome_str = ". ".join(diplome_lst)
row = {
"nom_pv": (
etud.code_ine or etud.code_nip or etud.id
@ -190,7 +198,7 @@ def pvjury_table_but(
else ""
)
),
"diplome": "ADM" if has_diplome else "",
"diplome": diplome_str,
# pour exports excel seulement:
"civilite": etud.civilite_etat_civil_str,
"nom": etud.nom,

View File

@ -69,6 +69,7 @@ from app.scodoc import sco_formsemestre
from app.scodoc import sco_groups
from app.scodoc import sco_preferences
from app.scodoc import sco_pv_dict
from app.scodoc import sco_pv_lettres_inviduelles
from app.scodoc import sco_users
import app.scodoc.sco_utils as scu
from app.scodoc.sco_utils import ModuleType, fmt_note
@ -711,6 +712,9 @@ def etud_descr_situation_semestre(
descr_mention : 'Mention Bien', ou vide si pas de mention ou si pas show_mention
diplomation : "Diplôme obtenu." ou ""
parcours_titre, parcours_code, refcomp_specialite, refcomp_specialite_long
diplome_dut120_descr: phrase explicative si DUT enregistré (en BUT)
diplome_dut120: booléen, vrai si DUT enregistré (en BUT)
"""
# Fonction utilisée par tous les bulletins (APC ou classiques)
infos = collections.defaultdict(str)
@ -830,12 +834,16 @@ def etud_descr_situation_semestre(
descr_dec += " Diplôme obtenu."
infos["diplomation"] = "Diplôme obtenu." if pv["validation_parcours"] else ""
# Ajoute diplome_dut120_descr et diplome_dut120
sco_pv_lettres_inviduelles.add_dut120_infos(formsemestre, etudid, infos)
_format_situation_fields(
infos,
[
"descr_inscription",
"descr_defaillance",
"descr_decisions_ue",
"diplome_dut120_descr",
"descr_decision_annee",
],
[descr_dec, descr_mention, descr_autorisations],

View File

@ -447,6 +447,7 @@ def dict_decision_jury(
'situation': 'Inscrit le 25/06/2021. Décision jury: Validé. UE acquises: '
'UE31, UE32. Diplôme obtenu.',
'diplomation' : 'Diplôme obtenu.' # (ou vide)
}
"""
from app.scodoc import sco_bulletins
@ -460,8 +461,10 @@ def dict_decision_jury(
formsemestre,
show_uevalid=prefs["bul_show_uevalid"],
)
d["situation"] = infos["situation"]
d["diplomation"] = infos["diplomation"]
d["situation"] = infos["situation"]
d["diplome_dut120"] = infos["diplome_dut120"]
d["diplome_dut120_descr"] = infos["diplome_dut120_descr"]
if dpv:
decision = dpv["decisions"][0]
etat = decision["etat"]

View File

@ -1350,7 +1350,7 @@ class BasePreferences:
"bul_show_decision",
{
"initvalue": 0,
"title": "Faire figurer les décisions sur les bulletins",
"title": "Faire figurer les décisions de jury sur les bulletins",
"input_type": "boolcheckbox",
"category": "bul",
"labels": ["non", "oui"],

View File

@ -43,7 +43,7 @@ from reportlab.platypus.doctemplate import BaseDocTemplate
from reportlab.lib import styles
from app import db
from app.models import FormSemestre, Identite
from app.models import FormSemestre, Identite, ValidationDUT120
import app.scodoc.sco_utils as scu
from app.scodoc import sco_bulletins_pdf
@ -347,7 +347,9 @@ def add_classic_infos(formsemestre: FormSemestre, params: dict, decision: dict):
def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict):
"""Ajoute les champs pour les formations APC (BUT), donc avec codes RCUE et année"""
"""Ajoute à params les champs pour les formations APC (BUT), avec codes RCUE et année
et diplome_dut120_descr
"""
annee_but = (formsemestre.semestre_id + 1) // 2
params["decision_orig"] = f"année BUT{annee_but}"
if decision is None:
@ -364,3 +366,24 @@ def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict):
'<br/>&nbsp;&nbsp;&nbsp;&nbsp;- '.join( decision.get("descr_decisions_rcue_list", []) )
}
"""
add_dut120_infos(formsemestre, decision["identite"]["etudid"], params)
def add_dut120_infos(formsemestre: FormSemestre, etudid: int, params: dict):
"""Ajout DUT120:
diplome_dut120_descr: phrase explicative si DUT enregistré
diplome_dut120: booléen, vrai si DUT enregistré
"""
validation_dut120 = ValidationDUT120.query.filter_by(
etudid=etudid, formsemestre_id=formsemestre.id
).first()
if validation_dut120:
params["diplome_dut120"] = True
params["diplome_dut120_descr"] = "Diplôme de DUT (BUT1, BUT2) validé"
if "decision_sem_descr" in params:
# sur decision_sem_descr afin que cela apparaisse sur les
# lettres individuelles sans avoir à modifier le paramétrage
params["decision_sem_descr"] += ". " + params["diplome_dut120_descr"]
else:
params["diplome_dut120"] = False
params["diplome_dut120_descr"] = ""

View File

@ -133,13 +133,16 @@
<div>ECTS acquis en BUT&nbsp;: <b>{{"%g"|format(ects_total)}}</b></div>
<div class="descr_jury">
{% if bul.semestre.decision_annee %}
Décision saisie le {{
{# Décision saisie le {{
datetime.datetime.fromisoformat(bul.semestre.decision_annee.date).strftime(scu.DATE_FMT)
}},
}}, #}
année <b>BUT{{bul.semestre.decision_annee.ordre}}</b>
<b>{{bul.semestre.decision_annee.code}}</b>.
{% endif %}
<div class="diplomation">{{bul.semestre.diplomation}}</div>
{% if diplome_dut120_descr %}
<div class="diplomation">{{diplome_dut120_descr}}.</div>
{% endif %}
{% set virg = joiner(", ") %}
{% for aut in bul.semestre.autorisation_inscription -%}
{% if loop.first %}