diff --git a/pscheck/models.py b/pscheck/models.py index 6181f5a..1979e2d 100644 --- a/pscheck/models.py +++ b/pscheck/models.py @@ -26,12 +26,12 @@ class Result: @dataclass class Vaccination(Result): - vaccine: str # vp - medical_product: str # mp - manufacturer: str # ma dose_number: int # dn total_series_of_doses: int # sd date_of_vaccination: str # dt + vaccine: Optional[str] = None # vp + medical_product: Optional[str] = None # mp + manufacturer: Optional[str] = None # ma def check(self) -> bool: # Toutes les doses ont bien été injectées @@ -68,13 +68,13 @@ class Test(Result): POSITIVE = '260373001' NEGATIVE = '260415000' - type_of_test: str # tt - test_name: str # nm - manufacturer: str # ma date: str # sc - result_date: str # dr result: TestResult # tr - center: str # tc + type_of_test: Optional[str] = None # tt + test_name: Optional[str] = None # nm + manufacturer: Optional[str] = None # ma + result_date: Optional[str] = None # dr + center: Optional[str] = None # tc @staticmethod def deserialize(payload) -> "Test": @@ -94,8 +94,8 @@ class Test(Result): return Test(**{translation[k]: v for k, v in payload.items()}) def check(self) -> bool: - valid = self.result == TestResult.NEGATIVE - test_date = datetime.datetime.fromisoformat(self.result_date) + valid = self.result == Test.TestResult.NEGATIVE + test_date = datetime.datetime.fromisoformat(self.date) tzinfo = test_date.tzinfo delta = datetime.datetime.now(tzinfo) - test_date valid = valid and delta.days < 3 # 72h de validité diff --git a/setup.cfg b/setup.cfg index 94a636e..6134609 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pscheck -version = 1.1 +version = 1.1.1 long_description = file: README.rst long_description_content_type = text/markdown description = Vérificateur de pass sanitaire