From 93d01cb158d46c47c8c1a4f728a0cefb2e242f7b Mon Sep 17 00:00:00 2001 From: "g.minoccari" Date: Fri, 7 May 2021 10:16:57 +0200 Subject: [PATCH] #bugfix Prevista la possibilita' che non esista la data nel database legata a un repository, e restituita stringa vuota nel json in quel caso --- code/backend/nest_backend/database/tables/Repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/backend/nest_backend/database/tables/Repository.py b/code/backend/nest_backend/database/tables/Repository.py index 7484202..669c9d6 100644 --- a/code/backend/nest_backend/database/tables/Repository.py +++ b/code/backend/nest_backend/database/tables/Repository.py @@ -22,5 +22,5 @@ class Repository(Base.Model): uses = Base.relationship("Uses", back_populates="repository") def to_json(self): - return {"id": self.id, "name": self.name, "start": self.start.isoformat(), "isActive":self.isActive, - "end":self.end.isoformat(),"owner": self.owner.to_json()} + return {"id": self.id, "name": self.name, "start": (self.start.isoformat() if self.start is not None else ""), "isActive":self.isActive, + "end":(self.end.isoformat() if self.end is not None else ""),"owner": self.owner.to_json()}