diff --git a/app/models/evaluations.py b/app/models/evaluations.py index ef2a628879..5b0960ba02 100644 --- a/app/models/evaluations.py +++ b/app/models/evaluations.py @@ -46,16 +46,23 @@ class Evaluation(db.Model): def __repr__(self): return f"""""" - def to_dict(self): + def to_dict(self) -> dict: + "Représentation dict, pour json" e = dict(self.__dict__) e.pop("_sa_instance_state", None) # ScoDoc7 output_formators e["evaluation_id"] = self.id - e["jour"] = ndb.DateISOtoDMY(e["jour"]) - e["date_debut"] = datetime.datetime.combine( - self.jour, self.heure_debut - ).isoformat() - e["date_fin"] = datetime.datetime.combine(self.jour, self.heure_fin).isoformat() + e["jour"] = e["jour"].strftime("%d/%m/%Y") if e["jour"] else "" + if self.jour is None: + e["date_debut"] = None + e["date_fin"] = None + else: + e["date_debut"] = datetime.datetime.combine( + self.jour, self.heure_debut or datetime.time(0, 0) + ).isoformat() + e["date_fin"] = datetime.datetime.combine( + self.jour, self.heure_fin or datetime.time(0, 0) + ).isoformat() e["numero"] = ndb.int_null_is_zero(e["numero"]) e["poids"] = self.get_ue_poids_dict() # { ue_id : poids } return evaluation_enrich_dict(e) diff --git a/sco_version.py b/sco_version.py index 120447d32f..3222274fa8 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.2.21" +SCOVERSION = "9.2.22" SCONAME = "ScoDoc"