From a83055125897382e3fbb177a8e6ddbf1bed5ce84 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 17 Aug 2021 19:51:38 +0200 Subject: [PATCH] =?UTF-8?q?Les=20vaccins=20sont=20valables=207=20jours=20a?= =?UTF-8?q?pr=C3=A8s=20la=20derni=C3=A8re=20dose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yohann D'ANELLO --- pscheck/pscheck.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pscheck/pscheck.py b/pscheck/pscheck.py index ad663fa..8392846 100644 --- a/pscheck/pscheck.py +++ b/pscheck/pscheck.py @@ -107,8 +107,15 @@ def analyse_qrcode(qrcode: str, additional_info: bool = False, p = payload[-260][1] if 'v' in p: - # Les vaccins sont toujours valide - valid = valid and True + # Les vaccins sont valides 7 jours après la dernière dose + vaccin = p['v'][0] + # Toutes les doses sont requises + valid = valid and vaccin['dn'] == vaccin['sd'] + # Vérification de la date + date = datetime.date.fromisoformat(vaccin['dt']) + today = datetime.date.today() + delta = today - date + valid = valid and delta.days >= 7 elif 't' in p: # Les tests négatifs sont valables moins de 72h test = p['t'][0]