Fix checks in UE2

This commit is contained in:
Ivaylo Ivanov 2021-10-28 19:44:46 +02:00
parent f876274311
commit abea7e2d1d

View File

@ -127,7 +127,7 @@ convert_to_utc (d, u) =
year = show (jahr d) year = show (jahr d)
vm = vm_to_ampm (uhrzeit_vornach u) vm = vm_to_ampm (uhrzeit_vornach u)
vhds = show (vhds_to_num (uhrzeit_vhds 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 date = year ++ "-" ++ month ++ "-" ++ day
time = hour ++ ":" ++ vhds ++ ":00" time = hour ++ ":" ++ vhds ++ ":00"
datetime = date ++ " " ++ time ++ " " ++ vm datetime = date ++ " " ++ time ++ " " ++ vm
@ -216,6 +216,7 @@ month_to_num Dez = 12
einzulassen :: (Person,Regel,Kontrollzeitpunkt) -> Kontrollergebnis einzulassen :: (Person,Regel,Kontrollzeitpunkt) -> Kontrollergebnis
einzulassen (p, r, k) einzulassen (p, r, k)
| not(is_date_valid k) = Ungueltig
| dreig_status p == Udrei = Abweisen | dreig_status p == Udrei = Abweisen
| otherwise = should_allow p r k | 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 :: Person -> Kontrollzeitpunkt -> Kontrollergebnis
check_cert_validity p k check_cert_validity p k
| not(is_date_valid k) = Ungueltig
| was_sick p = Einlassen | was_sick p = Einlassen
| is_vaccinated p && is_vaccine_fresh (dreig_status 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 | is_tested p && (is_test_fresh (dreig_status p) k) = Einlassen
| otherwise = Abweisen | otherwise = Abweisen
@ -269,8 +270,7 @@ is_vaccine_fresh g
is_test_fresh :: DreiG_Status -> Kontrollzeitpunkt -> Bool is_test_fresh :: DreiG_Status -> Kontrollzeitpunkt -> Bool
is_test_fresh g k is_test_fresh g k
| not(is_date_valid ((datum g), (uhrzeit g))) = False | testart g == Antigen = handle_test g k 1
| testart g == Antigen = handle_test g k 2
| testart g == PCR = handle_test g k 3 | testart g == PCR = handle_test g k 3
| otherwise = False | otherwise = False