diff --git a/app/but/jury_but.py b/app/but/jury_but.py index 8c19239f9..1598d0c8a 100644 --- a/app/but/jury_but.py +++ b/app/but/jury_but.py @@ -64,6 +64,7 @@ import re import numpy as np from flask import flash, g, url_for +import sqlalchemy as sa from app import db from app import log @@ -83,6 +84,7 @@ from app.models.but_validations import ( ApcValidationRCUE, ) from app.models.etudiants import Identite +from app.models.formations import Formation from app.models.formsemestre import FormSemestre from app.models.ues import UniteEns from app.models.validations import ScolarFormSemestreValidation @@ -90,6 +92,7 @@ from app.scodoc import sco_cache from app.scodoc import codes_cursus as sco_codes from app.scodoc.codes_cursus import ( code_rcue_validant, + code_ue_validant, BUT_CODES_ORDER, CODES_RCUE_VALIDES, CODES_UE_VALIDES, @@ -986,6 +989,36 @@ class DecisionsProposeesAnnee(DecisionsProposees): pour PV jurys """ validations = [] + # Validations antérieures émises par ce formsemestre + for res in (self.res_impair, self.res_pair): + if res: + validations_anterieures = ( + ScolarFormSemestreValidation.query.filter_by( + etudid=self.etud.id, formsemestre_id=res.formsemestre.id + ) + .filter( + ScolarFormSemestreValidation.semestre_id + != res.formsemestre.semestre_id + ) + .join(UniteEns) + .join(Formation) + .filter_by(formation_code=res.formsemestre.formation.formation_code) + .order_by( + sa.desc(UniteEns.semestre_idx), + UniteEns.acronyme, + sa.desc(ScolarFormSemestreValidation.event_date), + ) + .all() + ) + if validations_anterieures: + validations.append( + ", ".join( + v.ue.acronyme + for v in validations_anterieures + if v and v.ue and code_ue_validant(v.code) + ) + ) + # Validations des UEs des deux semestres de l'année for res in (self.res_impair, self.res_pair): if res: dec_ues = [ @@ -994,7 +1027,10 @@ class DecisionsProposeesAnnee(DecisionsProposees): if ue.type == UE_STANDARD and ue.id in self.decisions_ues ] valids = [dec_ue.descr_validation() for dec_ue in dec_ues] - validations.append(", ".join(v for v in valids if v)) + # présentation de la liste des UEs: + if valids: + validations.append(", ".join(v for v in valids if v)) + return line_sep.join(validations) def descr_pb_coherence(self) -> list[str]: diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index c20000fb4..22aca962e 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -8,7 +8,7 @@ """ from flask import g, request, url_for -from openpyxl.styles import Font, Border, Side, Alignment, PatternFill +from openpyxl.styles import Alignment from app import log from app.but import jury_but diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 988f0e9ea..3b3fa3b54 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -806,7 +806,7 @@ def formsemestre_recap_parcours_table( H.append( f"""