From 31f88280e4fb977d4072b74922fe405f2f0ab98c Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Thu, 28 Oct 2021 22:29:57 +0200 Subject: [PATCH] Finish UE2 A.3 --- code/Angabe2.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/Angabe2.hs b/code/Angabe2.hs index f06edfa..ee9a357 100644 --- a/code/Angabe2.hs +++ b/code/Angabe2.hs @@ -115,8 +115,18 @@ anzahl :: DreiG_Status -> Anzahl anzahl (Geimpft (_, a)) = a -- Dumb conversion functions +vorname_to_str :: Vorname -> String +vorname_to_str (Vorname v) = v + +nachname_to_str :: Nachname -> String +nachname_to_str (Nachname v) = v + person_to_string :: Person -> VorUndNachname -person_to_string p = (show (vorname p)) ++ " " ++ (show (nachname p)) +person_to_string p = + v ++ " " ++ n + where + v = vorname_to_str (vorname p) + n = nachname_to_str (nachname p) timeFormat = "%Y-%m-%d %0I:%0M:%S %p" @@ -317,6 +327,7 @@ einzulassende p r k = allowed_people p r k [] allowed_people :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> [VorUndNachname] -> Einzulassende allowed_people (p:ps) r k res + | ps == [] = res | (einzulassen (p, r, k)) == Einlassen = allowed_people ps r k (res ++ [person_to_string p]) | otherwise = allowed_people ps r k res