From abea7e2d1d3d995756e9befd8a765ab3184c9123 Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Thu, 28 Oct 2021 19:44:46 +0200 Subject: [PATCH] Fix checks in UE2 --- code/Angabe2.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/Angabe2.hs b/code/Angabe2.hs index 8f12859..7a41d0c 100644 --- a/code/Angabe2.hs +++ b/code/Angabe2.hs @@ -127,7 +127,7 @@ convert_to_utc (d, u) = year = show (jahr d) vm = vm_to_ampm (uhrzeit_vornach u) vhds = show (vhds_to_num (uhrzeit_vhds u)) - hour = (if vhds == "30" then show (hour_to_num (uhrzeit_stunde u) - 1) else show (hour_to_num (uhrzeit_stunde u))) + hour = (if vhds /= "0" then show (hour_to_num (uhrzeit_stunde u) - 1) else show (hour_to_num (uhrzeit_stunde u))) date = year ++ "-" ++ month ++ "-" ++ day time = hour ++ ":" ++ vhds ++ ":00" datetime = date ++ " " ++ time ++ " " ++ vm @@ -216,6 +216,7 @@ month_to_num Dez = 12 einzulassen :: (Person,Regel,Kontrollzeitpunkt) -> Kontrollergebnis einzulassen (p, r, k) + | not(is_date_valid k) = Ungueltig | dreig_status p == Udrei = Abweisen | otherwise = should_allow p r k @@ -241,9 +242,9 @@ should_allow p DreiG k = check_cert_validity p k -} check_cert_validity :: Person -> Kontrollzeitpunkt -> Kontrollergebnis check_cert_validity p k - | not(is_date_valid k) = Ungueltig | was_sick p = Einlassen | is_vaccinated p && is_vaccine_fresh (dreig_status p) = Einlassen + | is_tested p && not(is_date_valid ((datum (dreig_status p)), (uhrzeit (dreig_status p)))) = Ungueltig | is_tested p && (is_test_fresh (dreig_status p) k) = Einlassen | otherwise = Abweisen @@ -269,8 +270,7 @@ is_vaccine_fresh g is_test_fresh :: DreiG_Status -> Kontrollzeitpunkt -> Bool is_test_fresh g k - | not(is_date_valid ((datum g), (uhrzeit g))) = False - | testart g == Antigen = handle_test g k 2 + | testart g == Antigen = handle_test g k 1 | testart g == PCR = handle_test g k 3 | otherwise = False