API: fix /formsemestre/<int:formsemestre_id>/etat_evals et /formsemestre/<int:formsemestre_id>
This commit is contained in:
parent
2f5a786b2d
commit
9bd2290076
@ -342,10 +342,8 @@ def etat_evals(formsemestre_id: int):
|
|||||||
date_debut = notes_sorted[0].date
|
date_debut = notes_sorted[0].date
|
||||||
date_fin = notes_sorted[-1].date
|
date_fin = notes_sorted[-1].date
|
||||||
|
|
||||||
# Récupération de l'id de la note médiane
|
# Note médiane
|
||||||
list_id_notes_sorted = [note.id for note in notes_sorted]
|
date_mediane = notes_sorted[len(notes_sorted) // 2].date
|
||||||
id_mediane = list_id_notes_sorted[len(list_id_notes_sorted) // 2]
|
|
||||||
date_mediane = notes_sorted[id_mediane].date
|
|
||||||
|
|
||||||
eval_dict["saisie_notes"] = {
|
eval_dict["saisie_notes"] = {
|
||||||
"datetime_debut": date_debut.isoformat()
|
"datetime_debut": date_debut.isoformat()
|
||||||
@ -357,7 +355,7 @@ def etat_evals(formsemestre_id: int):
|
|||||||
else None,
|
else None,
|
||||||
}
|
}
|
||||||
|
|
||||||
list_eval.append(eval)
|
list_eval.append(eval_dict)
|
||||||
|
|
||||||
modimpl_dict["evaluations"] = list_eval
|
modimpl_dict["evaluations"] = list_eval
|
||||||
result.append(modimpl_dict)
|
result.append(modimpl_dict)
|
||||||
|
@ -179,8 +179,6 @@ class FormSemestre(db.Model):
|
|||||||
d = dict(self.__dict__)
|
d = dict(self.__dict__)
|
||||||
d.pop("_sa_instance_state", None)
|
d.pop("_sa_instance_state", None)
|
||||||
d["annee_scolaire"] = self.annee_scolaire_str()
|
d["annee_scolaire"] = self.annee_scolaire_str()
|
||||||
d["formsemestre_id"] = self.id
|
|
||||||
d["titre_num"] = self.titre_num()
|
|
||||||
if self.date_debut:
|
if self.date_debut:
|
||||||
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
|
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
|
||||||
d["date_debut_iso"] = self.date_debut.isoformat()
|
d["date_debut_iso"] = self.date_debut.isoformat()
|
||||||
@ -191,9 +189,12 @@ class FormSemestre(db.Model):
|
|||||||
d["date_fin_iso"] = self.date_fin.isoformat()
|
d["date_fin_iso"] = self.date_fin.isoformat()
|
||||||
else:
|
else:
|
||||||
d["date_fin"] = d["date_fin_iso"] = ""
|
d["date_fin"] = d["date_fin_iso"] = ""
|
||||||
|
d["etape_apo"] = self.etapes_apo_str()
|
||||||
|
d["formsemestre_id"] = self.id
|
||||||
|
d["parcours"] = [p.to_dict() for p in self.parcours]
|
||||||
d["responsables"] = [u.id for u in self.responsables]
|
d["responsables"] = [u.id for u in self.responsables]
|
||||||
d["titre_court"] = self.formation.acronyme
|
d["titre_court"] = self.formation.acronyme
|
||||||
d["parcours"] = [p.to_dict() for p in self.parcours]
|
d["titre_num"] = self.titre_num()
|
||||||
d["session_id"] = self.session_id()
|
d["session_id"] = self.session_id()
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user