Bulletins: champs situation avec code année et autorisations

This commit is contained in:
Emmanuel Viennet 2022-07-16 09:39:46 +02:00
parent 57223fa21d
commit b8bb61ef42

View File

@ -757,15 +757,16 @@ def etud_descr_situation_semestre(
if show_date_inscr: if show_date_inscr:
if not date_inscr: if not date_inscr:
infos["date_inscription"] = "" infos["date_inscription"] = ""
infos["descr_inscription"] = f"Pas inscrit{ne}." infos["descr_inscription"] = f"Pas inscrit{ne}"
else: else:
infos["date_inscription"] = date_inscr infos["date_inscription"] = date_inscr
infos["descr_inscription"] = f"Inscrit{ne} le {date_inscr}." infos["descr_inscription"] = f"Inscrit{ne} le {date_inscr}"
else: else:
infos["date_inscription"] = "" infos["date_inscription"] = ""
infos["descr_inscription"] = "" infos["descr_inscription"] = ""
infos["situation"] = infos["descr_inscription"] infos["descr_defaillance"] = ""
# Décision: valeurs par defaut vides: # Décision: valeurs par defaut vides:
infos["decision_jury"] = infos["descr_decision_jury"] = "" infos["decision_jury"] = infos["descr_decision_jury"] = ""
infos["decision_sem"] = "" infos["decision_sem"] = ""
@ -777,13 +778,14 @@ def etud_descr_situation_semestre(
infos["descr_demission"] = f"Démission le {date_dem}." infos["descr_demission"] = f"Démission le {date_dem}."
infos["date_demission"] = date_dem infos["date_demission"] = date_dem
infos["decision_jury"] = infos["descr_decision_jury"] = "Démission" infos["decision_jury"] = infos["descr_decision_jury"] = "Démission"
infos["situation"] += " " + infos["descr_demission"] infos["situation"] = ". ".join(
[x for x in [infos["descr_inscription"], infos["descr_demission"]] if x]
)
return infos, None # ne donne pas les dec. de jury pour les demissionnaires return infos, None # ne donne pas les dec. de jury pour les demissionnaires
if date_def: if date_def:
infos["descr_defaillance"] = f"Défaillant{ne}" infos["descr_defaillance"] = f"Défaillant{ne}"
infos["date_defaillance"] = date_def infos["date_defaillance"] = date_def
infos["descr_decision_jury"] = f"Défaillant{ne}" infos["descr_decision_jury"] = f"Défaillant{ne}"
infos["situation"] += " " + infos["descr_defaillance"]
dpv = sco_pvjury.dict_pvjury(formsemestre_id, etudids=[etudid]) dpv = sco_pvjury.dict_pvjury(formsemestre_id, etudids=[etudid])
if dpv: if dpv:
@ -794,28 +796,27 @@ def etud_descr_situation_semestre(
# Décisions de jury: # Décisions de jury:
pv = dpv["decisions"][0] pv = dpv["decisions"][0]
dec = "" descr_dec = ""
if pv["decision_sem_descr"]: if pv["decision_sem_descr"]:
infos["decision_jury"] = pv["decision_sem_descr"] infos["decision_jury"] = pv["decision_sem_descr"]
infos["descr_decision_jury"] = ( infos["descr_decision_jury"] = "Décision jury: " + pv["decision_sem_descr"]
"Décision jury: " + pv["decision_sem_descr"] + ". " descr_dec = infos["descr_decision_jury"]
)
dec = infos["descr_decision_jury"]
else: else:
infos["descr_decision_jury"] = "" infos["descr_decision_jury"] = ""
infos["decision_jury"] = "" infos["decision_jury"] = ""
if pv["decisions_ue_descr"] and show_uevalid: if pv["decisions_ue_descr"] and show_uevalid:
infos["decisions_ue"] = pv["decisions_ue_descr"] infos["decisions_ue"] = pv["decisions_ue_descr"]
infos["descr_decisions_ue"] = " UE acquises: " + pv["decisions_ue_descr"] + ". " infos["descr_decisions_ue"] = " UE acquises: " + pv["decisions_ue_descr"]
dec += infos["descr_decisions_ue"]
else: else:
infos["decisions_ue"] = "" infos["decisions_ue"] = ""
infos["descr_decisions_ue"] = "" infos["descr_decisions_ue"] = ""
infos["mention"] = pv["mention"] infos["mention"] = pv["mention"]
if pv["mention"] and show_mention: if pv["mention"] and show_mention:
dec += f"Mention {pv['mention']}." descr_mention = f"Mention {pv['mention']}"
else:
descr_mention = ""
# Décisions APC / BUT # Décisions APC / BUT
if pv.get("decision_annee", {}): if pv.get("decision_annee", {}):
@ -828,17 +829,44 @@ def etud_descr_situation_semestre(
infos["descr_decisions_rcue"] = pv.get("descr_decisions_rcue", "") infos["descr_decisions_rcue"] = pv.get("descr_decisions_rcue", "")
infos["descr_decisions_niveaux"] = pv.get("descr_decisions_niveaux", "") infos["descr_decisions_niveaux"] = pv.get("descr_decisions_niveaux", "")
infos["situation"] += " " + dec descr_autorisations = ""
if not pv["validation_parcours"]: # parcours non terminé if not pv["validation_parcours"]: # parcours non terminé
if pv["autorisations_descr"]: if pv["autorisations_descr"]:
infos[ descr_autorisations = (
"situation" f"Autorisé à s'inscrire en {pv['autorisations_descr']}."
] += f" Autorisé à s'inscrire en {pv['autorisations_descr']}." )
else: else:
infos["situation"] += " Diplôme obtenu." descr_dec += " Diplôme obtenu."
_format_situation_fields(
infos,
[
"descr_inscription",
"descr_defaillance",
"descr_decisions_ue",
"descr_decision_annee",
],
[descr_dec, descr_mention, descr_autorisations],
)
return infos, dpv return infos, dpv
def _format_situation_fields(
infos, field_names: list[str], extra_values: list[str]
) -> None:
"""Réuni les champs pour former le paragraphe "situation", et ajoute la pontuation aux champs."""
infos["situation"] = ". ".join(
x
for x in [infos.get(field_name, "") for field_name in field_names]
+ [field for field in extra_values if field]
if x
)
for field_name in field_names:
field = infos.get(field_name, "")
if field and not field.endswith("."):
infos[field_name] = "."
# ------ Page bulletin # ------ Page bulletin
def formsemestre_bulletinetud( def formsemestre_bulletinetud(
etud: Identite = None, etud: Identite = None,