From bb23cdcea73dde748be7116e7ac1923fc547a239 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 May 2024 19:18:57 +0200 Subject: [PATCH] =?UTF-8?q?PV=20jury:=20restreint=20cursus=20=C3=A0=20la?= =?UTF-8?q?=20formation=20actuelle.=20Fix=20#622.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_cursus_dut.py | 14 +++++++++----- app/scodoc/sco_pv_dict.py | 34 +++++++++++++++++++--------------- app/scodoc/sco_pv_forms.py | 2 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/app/scodoc/sco_cursus_dut.py b/app/scodoc/sco_cursus_dut.py index 47e7a5fef..10e17d4db 100644 --- a/app/scodoc/sco_cursus_dut.py +++ b/app/scodoc/sco_cursus_dut.py @@ -350,11 +350,13 @@ class SituationEtudCursusClassic(SituationEtudCursus): l'étudiant (quelle que soit la formation), le plus ancien en tête""" return self.sems - def get_cursus_descr(self, filter_futur=False): + def get_cursus_descr(self, filter_futur=False, filter_formation_code=False): """Description brève du parcours: "S1, S2, ..." Si filter_futur, ne mentionne pas les semestres qui sont après le semestre courant. + Si filter_formation_code, restreint aux semestres de même code formation que le courant. """ cur_begin_date = self.sem["dateord"] + cur_formation_code = self.sem["formation_code"] p = [] for s in self.sems: if s["ins"]["etat"] == scu.DEMISSION: @@ -363,12 +365,14 @@ class SituationEtudCursusClassic(SituationEtudCursus): dem = "" if filter_futur and s["dateord"] > cur_begin_date: continue # skip semestres demarrant apres le courant - SA = self.parcours.SESSION_ABBRV # 'S' ou 'A' + if filter_formation_code and s["formation_code"] != cur_formation_code: + continue # restreint aux semestres de la formation courante (pour les PV) + session_abbrv = self.parcours.SESSION_ABBRV # 'S' ou 'A' if s["semestre_id"] < 0: - SA = "A" # force, cas des DUT annuels par exemple - p.append("%s%d%s" % (SA, -s["semestre_id"], dem)) + session_abbrv = "A" # force, cas des DUT annuels par exemple + p.append("%s%d%s" % (session_abbrv, -s["semestre_id"], dem)) else: - p.append("%s%d%s" % (SA, s["semestre_id"], dem)) + p.append("%s%d%s" % (session_abbrv, s["semestre_id"], dem)) return ", ".join(p) def get_parcours_decisions(self): diff --git a/app/scodoc/sco_pv_dict.py b/app/scodoc/sco_pv_dict.py index e0a7223ed..b36c8b9b8 100644 --- a/app/scodoc/sco_pv_dict.py +++ b/app/scodoc/sco_pv_dict.py @@ -42,7 +42,6 @@ from app.models import ( but_validations, ) from app.scodoc import codes_cursus -from app.scodoc import sco_edit_ue from app.scodoc import sco_etud from app.scodoc import sco_formsemestre from app.scodoc import sco_cursus @@ -81,6 +80,7 @@ def dict_pvjury( }, 'autorisations' : [ { 'semestre_id' : { ... } } ], 'validation_parcours' : True si parcours validé (diplome obtenu) + 'parcours' : 'S1, S2, S3, S4, A1', 'prev_code' : code (calculé slt si with_prev), 'mention' : mention (en fct moy gen), 'sum_ects' : total ECTS acquis dans ce semestre (incluant les UE capitalisées) @@ -107,10 +107,12 @@ def dict_pvjury( D = {} # même chose que decisions, mais { etudid : dec } for etudid in etudids: etud = Identite.get_etud(etudid) - Se = sco_cursus.get_situation_etud_cursus( + situation_etud = sco_cursus.get_situation_etud_cursus( etud.to_dict_scodoc7(), formsemestre_id ) - semestre_non_terminal = semestre_non_terminal or Se.semestre_non_terminal + semestre_non_terminal = ( + semestre_non_terminal or situation_etud.semestre_non_terminal + ) d = {} d["identite"] = nt.identdict[etudid] d["etat"] = nt.get_etud_etat( @@ -120,9 +122,8 @@ def dict_pvjury( d["decisions_ue"] = nt.get_etud_decisions_ue(etudid) if formsemestre.formation.is_apc(): d.update(but_validations.dict_decision_jury(etud, formsemestre)) - d["last_formsemestre_id"] = Se.get_semestres()[ - -1 - ] # id du dernier semestre (chronologiquement) dans lequel il a été inscrit + # id du dernier semestre (chronologiquement) dans lequel il a été inscrit: + d["last_formsemestre_id"] = situation_etud.get_semestres()[-1] ects_capitalises_by_ue_code = _comp_ects_capitalises_by_ue_code(nt, etudid) d["sum_ects_capitalises"] = sum(ects_capitalises_by_ue_code.values()) @@ -162,10 +163,13 @@ def dict_pvjury( d["autorisations"] = [a.to_dict() for a in autorisations] d["autorisations_descr"] = descr_autorisations(autorisations) - d["validation_parcours"] = Se.parcours_validated() - d["parcours"] = Se.get_cursus_descr(filter_futur=True) + d["validation_parcours"] = situation_etud.parcours_validated() + d["parcours"] = situation_etud.get_cursus_descr(filter_futur=True) + d["parcours_in_cur_formation"] = situation_etud.get_cursus_descr( + filter_futur=True, filter_formation_code=True + ) if with_parcours_decisions: - d["parcours_decisions"] = Se.get_parcours_decisions() + d["parcours_decisions"] = situation_etud.get_parcours_decisions() # Observations sur les compensations: compensators = sco_cursus_dut.scolar_formsemestre_validation_list( cnx, args={"compense_formsemestre_id": formsemestre_id, "etudid": etudid} @@ -206,19 +210,19 @@ def dict_pvjury( if not info: continue # should not occur etud = info[0] - if Se.prev and Se.prev_decision: - d["prev_decision_sem"] = Se.prev_decision - d["prev_code"] = Se.prev_decision["code"] + if situation_etud.prev and situation_etud.prev_decision: + d["prev_decision_sem"] = situation_etud.prev_decision + d["prev_code"] = situation_etud.prev_decision["code"] d["prev_code_descr"] = _descr_decision_sem( - scu.INSCRIT, Se.prev_decision + scu.INSCRIT, situation_etud.prev_decision ) - d["prev"] = Se.prev + d["prev"] = situation_etud.prev has_prev = True else: d["prev_decision_sem"] = None d["prev_code"] = "" d["prev_code_descr"] = "" - d["Se"] = Se + d["Se"] = situation_etud decisions.append(d) D[etudid] = d diff --git a/app/scodoc/sco_pv_forms.py b/app/scodoc/sco_pv_forms.py index 27336f1fd..b204819ec 100644 --- a/app/scodoc/sco_pv_forms.py +++ b/app/scodoc/sco_pv_forms.py @@ -149,7 +149,7 @@ def pvjury_table( etudid=e["identite"]["etudid"], ), "_nomprenom_td_attrs": f"""id="{e['identite']['etudid']}" class="etudinfo" """, - "parcours": e["parcours"], + "parcours": e["parcours_in_cur_formation"], "decision": _descr_decision_sem_abbrev(e["etat"], e["decision_sem"]), "ue_cap": e["decisions_ue_descr"], "validation_parcours_code": "ADM" if e["validation_parcours"] else "",