diff --git a/app/but/jury_but.py b/app/but/jury_but.py index 4f3fb5c9c..a12877d92 100644 --- a/app/but/jury_but.py +++ b/app/but/jury_but.py @@ -1108,7 +1108,7 @@ def list_ue_parcour_etud( ues = ( formsemestre.formation.query_ues_parcour(parcour) .filter(UniteEns.semestre_idx == formsemestre.semestre_id) - .order_by(UniteEns.numero) + .order_by(UniteEns.numero, UniteEns.acronyme) .all() ) return [ue for ue in ues if (etud.id, ue.id) not in res.dispense_ues] diff --git a/app/comp/jury.py b/app/comp/jury.py index 6e701a54f..899d3ad8a 100644 --- a/app/comp/jury.py +++ b/app/comp/jury.py @@ -95,7 +95,7 @@ class ValidationsSemestre(ResultatsCache): for decision in ( decisions_jury_q.filter(db.text("ue_id is not NULL")) .join(UniteEns) - .order_by(UniteEns.numero) + .order_by(UniteEns.numero, UniteEns.acronyme) ): if decision.etudid not in decisions_jury_ues: decisions_jury_ues[decision.etudid] = {} diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 865352656..990eea672 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -471,7 +471,7 @@ class FormSemestre(models.ScoDocModel): ) if not with_sport: sem_ues = sem_ues.filter(UniteEns.type != codes_cursus.UE_SPORT) - ues = sem_ues.order_by(UniteEns.numero).all() + ues = sem_ues.order_by(UniteEns.numero, UniteEns.acronyme).all() _cache[key] = ues return ues @@ -1347,14 +1347,14 @@ class FormSemestre(models.ScoDocModel): etudid=etudid, formsemestre_id=self.id ) .join(UniteEns) - .order_by(UniteEns.numero) + .order_by(UniteEns.numero, UniteEns.acronyme) .all() ) # Validations BUT: vals_rcues = ( ApcValidationRCUE.query.filter_by(etudid=etudid, formsemestre_id=self.id) .join(UniteEns, ApcValidationRCUE.ue1) - .order_by(UniteEns.numero) + .order_by(UniteEns.numero, UniteEns.acronyme) .all() ) vals_annee = ( # issues de cette année scolaire seulement diff --git a/app/models/modules.py b/app/models/modules.py index ea15181c8..8e1d8c5b7 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -386,7 +386,7 @@ class Module(models.ScoDocModel): ues = ( self.formation.ues.filter_by(semestre_idx=self.ue.semestre_idx) .filter(UniteEns.type != UE_SPORT) - .order_by(UniteEns.numero) + .order_by(UniteEns.numero, UniteEns.acronyme) .all() ) if not ues: diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index f82b54cde..0050396a4 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -1332,19 +1332,7 @@ def _get_etud_ue_validations_html(etud: Identite, formsemestre: FormSemestre) -> """HTML listant les validations d'UEs pour cet étudiant dans des formations de même code que celle du formsemestre indiqué. """ - validations: list[ScolarFormSemestreValidation] = ( - ScolarFormSemestreValidation.query.filter_by(etudid=etud.id) - .join(UniteEns) - .join(Formation) - .filter_by(formation_code=formsemestre.formation.formation_code) - .order_by( - sa.desc(UniteEns.semestre_idx), - UniteEns.acronyme, - sa.desc(ScolarFormSemestreValidation.event_date), - ) - .all() - ) - + validations = get_etud_ue_validations(etud, formsemestre.formation) if not validations: return "" return render_template( @@ -1356,6 +1344,27 @@ def _get_etud_ue_validations_html(etud: Identite, formsemestre: FormSemestre) -> ) +def get_etud_ue_validations( + etud: Identite, formation: Formation +) -> list[ScolarFormSemestreValidation]: + """Retourne les validations d'UEs pour cet étudiant dans des formations de même + code que celle indiquée. + """ + return ( + ScolarFormSemestreValidation.query.filter_by(etudid=etud.id) + .join(UniteEns) + .join(Formation) + .filter_by(formation_code=formation.formation_code) + .order_by( + sa.desc(UniteEns.semestre_idx), + UniteEns.numero, + UniteEns.acronyme, + sa.desc(ScolarFormSemestreValidation.event_date), + ) + .all() + ) + + def do_formsemestre_validate_previous_ue( formsemestre: FormSemestre, etudid,