diff --git a/code/Angabe2.hs b/code/Angabe2.hs index 7a41d0c..247babb 100644 --- a/code/Angabe2.hs +++ b/code/Angabe2.hs @@ -270,22 +270,23 @@ is_vaccine_fresh g is_test_fresh :: DreiG_Status -> Kontrollzeitpunkt -> Bool is_test_fresh g k - | testart g == Antigen = handle_test g k 1 - | testart g == PCR = handle_test g k 3 + | testart g == Antigen = handle_test g k 24 + | testart g == PCR = handle_test g k 72 | otherwise = False handle_test :: DreiG_Status -> Kontrollzeitpunkt -> Nat1 -> Bool handle_test g k n - | (calculate_time_diff ((datum g), (uhrzeit g)) k) <= m = True + | (calculate_time_diff ((datum g), (uhrzeit g)) k) > 0 = False + | abs(calculate_time_diff ((datum g), (uhrzeit g)) k) <= m = True | otherwise = False - where m = toEnum(n * 24 * 60 * 60) + where m = (fromInteger (toInteger (n * 60 * 60))) :: NominalDiffTime {- function that calculates the difference in seconds between two datetimes -} calculate_time_diff :: (Datum, Uhrzeit) -> (Datum, Uhrzeit) -> NominalDiffTime calculate_time_diff u1 u2 = - abs(diffUTCTime (convert_to_utc u1) (convert_to_utc u2)) + diffUTCTime (convert_to_utc u1) (convert_to_utc u2) -- Aufgabe A.3