1
0
forked from ScoDoc/ScoDoc

API: fix /formsemestre/<int:formsemestre_id>/etat_evals et /formsemestre/<int:formsemestre_id>

This commit is contained in:
Emmanuel Viennet 2022-07-22 21:22:06 +02:00
parent 2f5a786b2d
commit 9bd2290076
2 changed files with 7 additions and 8 deletions

View File

@ -342,10 +342,8 @@ def etat_evals(formsemestre_id: int):
date_debut = notes_sorted[0].date
date_fin = notes_sorted[-1].date
# Récupération de l'id de la note médiane
list_id_notes_sorted = [note.id for note in notes_sorted]
id_mediane = list_id_notes_sorted[len(list_id_notes_sorted) // 2]
date_mediane = notes_sorted[id_mediane].date
# Note médiane
date_mediane = notes_sorted[len(notes_sorted) // 2].date
eval_dict["saisie_notes"] = {
"datetime_debut": date_debut.isoformat()
@ -357,7 +355,7 @@ def etat_evals(formsemestre_id: int):
else None,
}
list_eval.append(eval)
list_eval.append(eval_dict)
modimpl_dict["evaluations"] = list_eval
result.append(modimpl_dict)

View File

@ -179,8 +179,6 @@ class FormSemestre(db.Model):
d = dict(self.__dict__)
d.pop("_sa_instance_state", None)
d["annee_scolaire"] = self.annee_scolaire_str()
d["formsemestre_id"] = self.id
d["titre_num"] = self.titre_num()
if self.date_debut:
d["date_debut"] = self.date_debut.strftime("%d/%m/%Y")
d["date_debut_iso"] = self.date_debut.isoformat()
@ -191,9 +189,12 @@ class FormSemestre(db.Model):
d["date_fin_iso"] = self.date_fin.isoformat()
else:
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["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()
return d