S{deca.formsemestre_impair.semestre_id
@@ -93,7 +93,10 @@ def show_etud(deca: DecisionsProposeesAnnee, read_only: bool = True) -> str:
)
dec_rcue = deca.decisions_rcue_by_niveau.get(niveau.id)
if dec_rcue is None:
- break
+ H.append(
+ """
"""
+ )
+ continue
# Semestre impair
H.append(
_gen_but_niveau_ue(
diff --git a/app/models/modules.py b/app/models/modules.py
index c73d82fd49..77c0627497 100644
--- a/app/models/modules.py
+++ b/app/models/modules.py
@@ -220,25 +220,31 @@ class Module(db.Model):
# à redéfinir les relationships...
return sorted(self.ue_coefs, key=lambda x: x.ue.numero)
- def ue_coefs_list(self, include_zeros=True):
+ def ue_coefs_list(
+ self, include_zeros=True, ues: list["UniteEns"] = None
+ ) -> list[tuple["UniteEns", float]]:
"""Liste des coefs vers les UE (pour les modules APC).
- Si include_zeros, liste aussi les UE sans coef (donc nul) de ce semestre,
+ Si ues est spécifié, restreint aux UE indiquées.
+ Sinon si include_zeros, liste aussi les UE sans coef (donc nul) de ce semestre,
sauf UE bonus sport.
Result: List of tuples [ (ue, coef) ]
"""
if not self.is_apc():
return []
- if include_zeros:
+ if include_zeros and ues is None:
# Toutes les UE du même semestre:
- ues_semestre = (
+ ues = (
self.formation.ues.filter_by(semestre_idx=self.ue.semestre_idx)
.filter(UniteEns.type != UE_SPORT)
.order_by(UniteEns.numero)
.all()
)
+ if not ues:
+ return []
+ if ues:
coefs_dict = self.get_ue_coef_dict()
coefs_list = []
- for ue in ues_semestre:
+ for ue in ues:
coefs_list.append((ue, coefs_dict.get(ue.id, 0.0)))
return coefs_list
# Liste seulement les coefs définis:
diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py
index ae7f29bdb0..85eac7241a 100644
--- a/app/scodoc/sco_formsemestre_status.py
+++ b/app/scodoc/sco_formsemestre_status.py
@@ -1105,7 +1105,7 @@ def formsemestre_status(formsemestre_id=None):
{formsemestre_tableau_modules(
- ressources, nt, formsemestre_id, can_edit=can_edit, show_ues=False
+ ressources, nt, formsemestre, can_edit=can_edit, show_ues=False
)}
@@ -1113,7 +1113,7 @@ def formsemestre_status(formsemestre_id=None):
|
""",
formsemestre_tableau_modules(
- saes, nt, formsemestre_id, can_edit=can_edit, show_ues=False
+ saes, nt, formsemestre, can_edit=can_edit, show_ues=False
),
]
if autres:
@@ -1123,7 +1123,7 @@ def formsemestre_status(formsemestre_id=None):
Autres modules
""",
formsemestre_tableau_modules(
- autres, nt, formsemestre_id, can_edit=can_edit, show_ues=False
+ autres, nt, formsemestre, can_edit=can_edit, show_ues=False
),
]
H += [_TABLEAU_MODULES_FOOT, "
"]
@@ -1135,7 +1135,7 @@ def formsemestre_status(formsemestre_id=None):
formsemestre_tableau_modules(
modimpls,
nt,
- formsemestre_id,
+ formsemestre,
can_edit=can_edit,
use_ue_coefs=use_ue_coefs,
),
@@ -1182,7 +1182,7 @@ _TABLEAU_MODULES_FOOT = """"""
def formsemestre_tableau_modules(
modimpls: list[dict],
nt,
- formsemestre_id: int,
+ formsemestre: FormSemestre,
can_edit=True,
show_ues=True,
use_ue_coefs=False,
@@ -1226,13 +1226,13 @@ def formsemestre_tableau_modules(
)
expr = sco_compute_moy.get_ue_expression(
- formsemestre_id, ue["ue_id"], html_quote=True
+ formsemestre.id, ue["ue_id"], html_quote=True
)
if expr:
H.append(
f"""
"""
)
@@ -1279,7 +1279,7 @@ def formsemestre_tableau_modules(
"""
)
if mod.module_type in (ModuleType.RESSOURCE, ModuleType.SAE):
- coefs = mod.ue_coefs_list()
+ coefs = mod.ue_coefs_list(ues=formsemestre.query_ues().all())
H.append(f'