On corrige le cas des ical vides

This commit is contained in:
Jean-Marie Favreau 2024-09-21 20:56:03 +02:00
parent 38a7fd7e73
commit 67469cf339
2 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,9 @@ class DBImporterEvents:
except: except:
return (False, "JSON file is not correctly structured") return (False, "JSON file is not correctly structured")
if len(structure) == 0:
return (True, "")
if "header" not in structure: if "header" not in structure:
return (False, "JSON is not correctly structured: missing header") return (False, "JSON is not correctly structured: missing header")
if "events" not in structure: if "events" not in structure:

View File

@ -214,7 +214,7 @@ class Extractor(ABC):
def get_structure(self): def get_structure(self):
if len(self.events) == 0: if len(self.events) == 0:
return None return {}
else: else:
return {"header": self.header, "events": self.events} return {"header": self.header, "events": self.events}