From 9ee36f5eba082a25bf6ad6e720af6f698b71b6e1 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Sat, 17 Jun 2023 14:56:04 +0200
Subject: [PATCH] Fix: ordre des RCUE sur les bulletins

---
 app/models/but_validations.py | 8 ++++++--
 sco_version.py                | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/app/models/but_validations.py b/app/models/but_validations.py
index d9b0e7e2d..c2be058b3 100644
--- a/app/models/but_validations.py
+++ b/app/models/but_validations.py
@@ -360,8 +360,12 @@ def dict_decision_jury(etud: Identite, formsemestre: FormSemestre) -> dict:
     # --- RCUEs: seulement sur semestres pairs XXX à améliorer
     if formsemestre.semestre_id % 2 == 0:
         # validations émises depuis ce formsemestre:
-        validations_rcues = ApcValidationRCUE.query.filter_by(
-            etudid=etud.id, formsemestre_id=formsemestre.id
+        validations_rcues = (
+            ApcValidationRCUE.query.filter_by(
+                etudid=etud.id, formsemestre_id=formsemestre.id
+            )
+            .join(UniteEns, UniteEns.id == ApcValidationRCUE.ue1_id)
+            .order_by(UniteEns.numero, UniteEns.acronyme)
         )
         decisions["decision_rcue"] = [v.to_dict_bul() for v in validations_rcues]
         titres_rcues = []
diff --git a/sco_version.py b/sco_version.py
index cb65163a2..02d22d18d 100644
--- a/sco_version.py
+++ b/sco_version.py
@@ -1,7 +1,7 @@
 # -*- mode: python -*-
 # -*- coding: utf-8 -*-
 
-SCOVERSION = "9.4.85"
+SCOVERSION = "9.4.86"
 
 SCONAME = "ScoDoc"