From f0da8434a9cadb55464ef58657e1aaa6d8a9b1f2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 17 Dec 2022 10:05:13 -0300 Subject: [PATCH] Groupes de parcours: API, avertissements. --- app/models/formsemestre.py | 6 +++--- app/scodoc/sco_formsemestre_edit.py | 3 ++- app/scodoc/sco_formsemestre_status.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index de514dbe..1c00d633 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -176,7 +176,7 @@ class FormSemestre(db.Model): d["responsables"] = [u.id for u in self.responsables] d["titre_formation"] = self.titre_formation() if convert_objects: - d["parcours"] = [p.to_dict() for p in self.parcours] + d["parcours"] = [p.to_dict() for p in self.get_parcours_apc()] d["departement"] = self.departement.to_dict() d["formation"] = self.formation.to_dict() d["etape_apo"] = self.etapes_apo_str() @@ -203,7 +203,7 @@ class FormSemestre(db.Model): d["etape_apo"] = self.etapes_apo_str() d["formsemestre_id"] = self.id d["formation"] = self.formation.to_dict() - d["parcours"] = [p.to_dict() for p in self.parcours] + d["parcours"] = [p.to_dict() for p in self.get_parcours_apc()] d["responsables"] = [u.id for u in self.responsables] d["titre_court"] = self.formation.acronyme d["titre_num"] = self.titre_num() @@ -696,7 +696,7 @@ class FormSemestre(db.Model): # - s'ils n'ont pas d'inscrits, supprime-les. # - s'ils ont des inscrits: avertissement for group in GroupDescr.query.filter_by(partition_id=partition.id): - if group.group_name not in (p.code for p in self.parcours): + if group.group_name not in (p.code for p in self.get_parcours_apc()): if ( len( [ diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 3eee1a67..549bdb28 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -562,7 +562,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N ] if edit: initvalues["parcours"] = [ - str(parcour.id) for parcour in formsemestre.parcours + str(parcour.id) for parcour in formsemestre.get_parcours_apc() ] else: modform += [ @@ -961,6 +961,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N "notes.formsemestre_status", scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id, + check_parcours=0, ) ) else: diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index c961dadf..7c93ee10 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -1040,7 +1040,7 @@ def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None return "".join(H) -def formsemestre_status(formsemestre_id=None): +def formsemestre_status(formsemestre_id=None, check_parcours=True): """Tableau de bord semestre HTML""" # porté du DTML if formsemestre_id is not None and not isinstance(formsemestre_id, int): @@ -1049,7 +1049,8 @@ def formsemestre_status(formsemestre_id=None): ) formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id) # S'assure que les groupes de parcours sont à jour: - formsemestre.setup_parcours_groups() + if int(check_parcours): + formsemestre.setup_parcours_groups() modimpls = sco_moduleimpl.moduleimpl_withmodule_list( formsemestre_id=formsemestre_id )