From 860f5b9ad527c873ebfceafa0f1bffee412c2af2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 27 Jun 2022 22:12:57 +0200 Subject: [PATCH] Modif exception _formsemestre_enrich --- app/scodoc/sco_formsemestre.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index 8d286b22..32c2d9e3 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -147,7 +147,12 @@ def _formsemestre_enrich(sem): # imports ici pour eviter refs circulaires from app.scodoc import sco_formsemestre_edit - F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0] + formations = sco_formations.formation_list( + args={"formation_id": sem["formation_id"]} + ) + if not formations: + raise ScoValueError("pas de formation pour ce semestre !") + F = formations[0] parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"]) # 'S1', 'S2', ... ou '' pour les monosemestres if sem["semestre_id"] != NO_SEMESTRE_ID: