forked from ScoDoc/ScoDoc
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):
|
def __repr__(self):
|
||||||
return f"""<Evaluation {self.id} {self.jour.isoformat() if self.jour else ''} "{self.description[:16] if self.description else ''}">"""
|
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 = dict(self.__dict__)
|
||||||
e.pop("_sa_instance_state", None)
|
e.pop("_sa_instance_state", None)
|
||||||
# ScoDoc7 output_formators
|
# ScoDoc7 output_formators
|
||||||
e["evaluation_id"] = self.id
|
e["evaluation_id"] = self.id
|
||||||
e["jour"] = ndb.DateISOtoDMY(e["jour"])
|
e["jour"] = e["jour"].strftime("%d/%m/%Y") if e["jour"] else ""
|
||||||
e["date_debut"] = datetime.datetime.combine(
|
if self.jour is None:
|
||||||
self.jour, self.heure_debut
|
e["date_debut"] = None
|
||||||
).isoformat()
|
e["date_fin"] = None
|
||||||
e["date_fin"] = datetime.datetime.combine(self.jour, self.heure_fin).isoformat()
|
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["numero"] = ndb.int_null_is_zero(e["numero"])
|
||||||
e["poids"] = self.get_ue_poids_dict() # { ue_id : poids }
|
e["poids"] = self.get_ue_poids_dict() # { ue_id : poids }
|
||||||
return evaluation_enrich_dict(e)
|
return evaluation_enrich_dict(e)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.2.21"
|
SCOVERSION = "9.2.22"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user