forked from ScoDoc/DocScoDoc
Fix: json evaluations sans dates
This commit is contained in:
parent
878ea41933
commit
5e46d2fc35
@ -46,16 +46,23 @@ class Evaluation(db.Model):
|
||||
def __repr__(self):
|
||||
return f"""<Evaluation {self.id} {self.jour.isoformat() if self.jour else ''} "{self.description[:16] if self.description else ''}">"""
|
||||
|
||||
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)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.2.21"
|
||||
SCOVERSION = "9.2.22"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user