Fix pour les tests
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
38ac206c74
commit
1fc2beb609
@ -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é
|
||||
|
Loading…
Reference in New Issue
Block a user