Skip to content
Snippets Groups Projects
Commit 4f292ce0 authored by beekmannju85374's avatar beekmannju85374 :writing_hand:
Browse files

adjusted comments for csv

parent a589d6c9
No related branches found
No related tags found
1 merge request!8Master
Example.png

342 KiB

......@@ -54,17 +54,7 @@ instance Ord Presentation where
main :: IO ()
main = do
p <- processCsv "professors1.csv"
let g1 = head $ generateSchedules ["H","P"] "2024-04-04" "2024-07-06" p
putStrLn "p <- processCsv \"professors1.csv"
print p
putStrLn "head $ generateSchedules [\"H\",\"P\"] \"2024-04-04\" \"2024-07-06\" p"
print g1
putStrLn "schedule [\"H\",\"P\"] \"2024-04-04\" \"2024-07-06\" p"
schedule ["H","P"] "2024-04-04" "2024-07-06" p
putStrLn "created LaTeX file in presentations.tex"
putStrLn "use schedule for generating a LaTex file, use generateSchedules to list all possible schedules"
putStrLn "Hello"
-- example:
-- ghci> p <- processCsv "professors1.csv"
......@@ -225,7 +215,7 @@ addProfUnavailability prof unavailables rooms startDay endDay oldPresentations =
where
oldPresentationsFlat = concat oldPresentations
updatedProf = prof { unavailableDays = readDays unavailables ++ unavailableDays prof }
updatedPresentations = filter (\pres -> professor pres /= updatedProf) oldPresentationsFlat
updatedPresentations = filter (\pres -> professor pres /= prof) oldPresentationsFlat
newGroups = addProfessor updatedProf rooms startDay endDay [updatedPresentations] --bland grouping for addProfessor
-- ein Professor braucht nur eine Präsentation pro Projekt = jeder Professor muss in einer Liste von Präsentation mit seinen Präsentationen vertreten sein
......@@ -308,46 +298,6 @@ adjustHolidaysTH start end =
(adjustBankHolidays, adjustExtraHolidays)
p1 :: Professor
p1 = Professor
{ profName = "Professor 1"
, unavailableDays = [readDay "2024-04-04"]
, availableDays = []
, projects = ["Project 1", "Project N"]
}
p2 :: Professor
p2 = Professor
{ profName = "Professor 2"
, unavailableDays = [readDay "2024-04-11"]
, availableDays = []
, projects = ["Project 2"]
}
p3 :: Professor
p3 = Professor
{ profName = "Professor 3"
, unavailableDays = [readDay "2024-04-04"]
, availableDays = []
, projects = ["Project 3"]
}
p4 :: Professor
p4 = Professor
{ profName = "Professor 4"
, unavailableDays = [readDay "2024-04-18"]
, availableDays = []
, projects = ["Project 4"]
}
p5 :: Professor
p5 = Professor
{ profName = "Professor 5"
, unavailableDays = [readDay "2024-04-18"]
, availableDays = []
, projects = ["Project 5"]
}
prettyPrint :: Presentation -> String
prettyPrint p = "Presentation:\n" ++
" Room: " ++ room p ++
......@@ -359,13 +309,16 @@ prettyPrint p = "Presentation:\n" ++
{-
-- CSV handling:
name,projects,unavailableDays
Zapf,THNSensor;MMO,2024-04-04;2024-04-18
name,projects,unavailableDays,availableDays
Duman,KI-Survey1,2024-04-04;2024-04-11,
Zapf,THNSensor,,2024-04-04;2024-04-11
-> Duman is busy on 04.04 and 11.04
Zapf is only available on 04.04 and 11.04
format: YYYY-mm-dd
projects, days seperated by ;
option to input available instead of unavailable days will probably be handled by checking for a + before the day (+2024-04-18;+2024-06-06) -}
-}
processCsv :: FilePath -> IO [Professor]
processCsv filePath = do
......@@ -379,7 +332,7 @@ processCsv filePath = do
-- LaTeX handling:
-- produces a .tex file from an ordered list of presentations
-- produces a .tex file from a grouped list of presentations
generateLaTeX :: [[Presentation]] -> String
generateLaTeX presentations = unlines $ header ++ zipWith formatGroup [1..] presentations ++ footer
where
......@@ -405,7 +358,7 @@ generateLaTeX presentations = unlines $ header ++ zipWith formatGroup [1..] pre
formatGroup :: Int -> [Presentation] -> String
formatGroup _ [] = ""
formatGroup i ps =
"\\noindent \\textbf{Vortragsgruppe " ++ show i ++ "}" ++ "\\\\" ++ "\n" ++
"\\noindent \\textbf{Vortragsgruppe S" ++ show i ++ "}" ++ "\\\\" ++ "\n" ++
-- CHANGE TIME HERE
"Beginn: " ++ "14:00" ++ "\\\\" ++ "\n" ++
......@@ -416,7 +369,7 @@ formatGroup i ps =
formatPresentation :: Presentation -> String
formatPresentation p =
"\t" ++ formatDay (day p) ++ " & " ++ project p ++ " & " ++ (profName . professor) p ++ " & " ++ room p ++ "\\\\" ++ "\n"
"\t" ++ formatDay (day p) ++ " & " ++ project p ++ " & " ++ (profName . professor) p ++ " & " ++ room p ++ "\\\\" ++ "\n"
placeBetween :: String -> [String] -> String
placeBetween _ [] = ""
......@@ -438,4 +391,44 @@ g rooms startDay endDay professors = sort presentations
, day `notElem` unavailableDays prof
, proj <- projects prof
]
\ No newline at end of file
]
p1 :: Professor
p1 = Professor
{ profName = "Professor 1"
, unavailableDays = [readDay "2024-04-04"]
, availableDays = []
, projects = ["Project 1", "Project N"]
}
p2 :: Professor
p2 = Professor
{ profName = "Professor 2"
, unavailableDays = [readDay "2024-04-11"]
, availableDays = []
, projects = ["Project 2"]
}
p3 :: Professor
p3 = Professor
{ profName = "Professor 3"
, unavailableDays = [readDay "2024-04-04"]
, availableDays = []
, projects = ["Project 3"]
}
p4 :: Professor
p4 = Professor
{ profName = "Professor 4"
, unavailableDays = [readDay "2024-04-18"]
, availableDays = []
, projects = ["Project 4"]
}
p5 :: Professor
p5 = Professor
{ profName = "Professor 5"
, unavailableDays = [readDay "2024-04-18"]
, availableDays = []
, projects = ["Project 5"]
}
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -11,48 +11,22 @@
\lhead{\thetitle}
\title{IT-Projekte XxXx 20YY}
\begin{document}
\noindent \textbf{Vortragsgruppe 1}\\
\noindent \textbf{Vortragsgruppe S1}\\
Beginn: 14:00\\
\begin{tabular}{@{}llll}
Datum & Projektgruppe & Dozent/in & Raum \\
04.04.24 & Memtest & Meier & H\\
11.04.24 & project1N & P1 & H\\
18.04.24 & KI-Survey1 & Duman & H\\
25.04.24 & Memtest2 & Meier & H\\
02.05.24 & project2N & P2 & H\\
Datum & Projektgruppe & Dozent/in & Raum\\
04.04.24 & Project 2 & Professor 2 & H\\
11.04.24 & Project 1 & Professor 1 & H\\
18.04.24 & Project N & Professor 1 & H\\
\end{tabular}
\\\\
\noindent \textbf{Vortragsgruppe 2}\\
\noindent \textbf{Vortragsgruppe S2}\\
Beginn: 14:00\\
\begin{tabular}{@{}llll}
Datum & Projektgruppe & Dozent/in & Raum \\
16.05.24 & project4 & P4 & H\\
23.05.24 & project45 & P4 & H\\
06.06.24 & project7 & P7 & H\\
13.06.24 & project9 & P9 & H\\
20.06.24 & MMO2 & Schulz & H\\
\end{tabular}
\\\\
\noindent \textbf{Vortragsgruppe 3}\\
Beginn: 14:00\\
\begin{tabular}{@{}llll}
Datum & Projektgruppe & Dozent/in & Raum \\
04.04.24 & project1 & P1 & P\\
11.04.24 & project11 & P11 & P\\
18.04.24 & project10 & P10 & P\\
25.04.24 & project2 & P2 & P\\
02.05.24 & project3 & P3 & P\\
\end{tabular}
\\\\
\noindent \textbf{Vortragsgruppe 4}\\
Beginn: 14:00\\
\begin{tabular}{@{}llll}
Datum & Projektgruppe & Dozent/in & Raum \\
16.05.24 & project5 & P5 & P\\
23.05.24 & project6 & P6 & P\\
06.06.24 & project8 & P8 & P\\
13.06.24 & MMO & Schulz & P\\
20.06.24 & THNSensor & Zapf & P\\
Datum & Projektgruppe & Dozent/in & Raum\\
25.04.24 & Project 5 & Professor 5 & H\\
04.04.24 & Project 4 & Professor 4 & P\\
11.04.24 & Project 3 & Professor 3 & P\\
\end{tabular}
\\\\
\end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment