Groupes de parcours: API, avertissements.

This commit is contained in:
Emmanuel Viennet 2022-12-17 10:05:13 -03:00 committed by iziram
parent e995228ca7
commit f0da8434a9
3 changed files with 8 additions and 6 deletions

View File

@ -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(
[

View File

@ -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:

View File

@ -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
)