diff --git a/src/Utils/Schedule/Types/ScheduleEntry.hs b/src/Utils/Schedule/Types/ScheduleEntry.hs
index e2edf21d5..cff4f3a1f 100644
--- a/src/Utils/Schedule/Types/ScheduleEntry.hs
+++ b/src/Utils/Schedule/Types/ScheduleEntry.hs
@@ -27,7 +27,7 @@ data ScheduleEntry = ScheduleCourseEvent
| ScheduleExamOccurrence
{ seoCourse :: Entity Course
, seoExamName :: ExamName
- , seoRooms :: NonEmpty (Maybe RoomReference, Bool) -- TODO: remove Nothing values and use NonEmpty (RoomReference, Bool) instead?
+ , seoRooms :: Set (Maybe RoomReference, Bool)
, seoStart :: UTCTime
, seoEnd :: Maybe UTCTime
}
diff --git a/src/Utils/Schedule/Week.hs b/src/Utils/Schedule/Week.hs
index bcca0bbd3..e2717c485 100644
--- a/src/Utils/Schedule/Week.hs
+++ b/src/Utils/Schedule/Week.hs
@@ -131,7 +131,6 @@ weekSchedule now user@(Entity uid User{userScheduleWeekDays = ScheduleWeekDays u
| otherwise
= mempty
- -- TODO: introduce type synonym for (Entity Course, Entity Exam, Entity ExamOccurrence)?
joinParallelExamOccurrences :: [ScheduleExamOccurrenceInfo] -> [ScheduleExamOccurrenceJoinedInfo]
joinParallelExamOccurrences = go [] where
go acc [] = acc
@@ -144,9 +143,9 @@ weekSchedule now user@(Entity uid User{userScheduleWeekDays = ScheduleWeekDays u
examOccurrenceToScheduleEntry :: ScheduleExamOccurrenceJoinedInfo -> ScheduleEntry
examOccurrenceToScheduleEntry (seoCourse@(Entity _ Course{}), Entity _ Exam{examName=seoExamName}, examOccs@((Entity _ occ, _):|_)) =
- let seoRooms = (\(Entity _ ExamOccurrence{examOccurrenceRoom}, E.Value showRoom) -> (examOccurrenceRoom, showRoom)) <$> examOccs
- seoStart = examOccurrenceStart occ -- multiple exam occurrences are joined on equality of start and end,
- seoEnd = examOccurrenceEnd occ -- so taking the timestamps of the first occurrence suffices
+ let seoRooms = (Set.fromList . toList) $ (\(Entity _ ExamOccurrence{examOccurrenceRoom}, E.Value showRoom) -> (examOccurrenceRoom, showRoom)) <$> examOccs
+ seoStart = examOccurrenceStart occ -- multiple exam occurrences are joined on equality of start and end,
+ seoEnd = examOccurrenceEnd occ -- so taking the timestamps of the first occurrence suffices
in ScheduleExamOccurrence{..}
events'' :: Map Day (Map TimeSlot [(ScheduleEntry, SlotAssociation)])
diff --git a/templates/schedule/week.hamlet b/templates/schedule/week.hamlet
index 80af7a39f..3c30bb62d 100644
--- a/templates/schedule/week.hamlet
+++ b/templates/schedule/week.hamlet
@@ -32,12 +32,9 @@ $newline never
(_{MsgScheduleWeekSlotIsCont})
$if sceShowRoom
- _{MsgScheduleRoom}: #
$maybe room <- sceRoom
- ^{roomReferenceWidget room}
- $nothing
- _{MsgCourseEventRoomIsUnset}
-
+ ^_{MsgScheduleRoom}: ^{roomReferenceWidget room}
+
^{formatEitherOccurrenceW sceOccurrence}
$of ScheduleTutorial{stCourse=Entity _ Course{courseName},stName,stType,stRoom,stShowRoom,stOccurrence}
#{CI.original courseName}: #{stName} #
@@ -48,28 +45,28 @@ $newline never
)
$if stShowRoom
- _{MsgScheduleRoom}: #
$maybe room <- stRoom
- ^{roomReferenceWidget room}
- $nothing
- _{MsgTutorialRoomIsUnset}
-
+ _{MsgScheduleRoom}: ^{roomReferenceWidget room}
+
^{formatEitherOccurrenceW stOccurrence}
$of ScheduleExamOccurrence{seoCourse=Entity _ Course{courseName},seoExamName,seoRooms,seoStart,seoEnd}
#{CI.original courseName}: #{seoExamName}
$if slotAssocIsCont slotAssociation
(_{MsgScheduleWeekSlotIsCont})
- $case toList seoRooms
- $of [(mRoom,showRoom)]
+ $case Set.toList seoRooms
+ $of []
+ $of [(mRoom, showRoom)]
$if showRoom
- _{MsgScheduleRoom}: ^{maybe mempty roomReferenceWidget mRoom}
-
+ $maybe room <- mRoom
+ _{MsgScheduleRoom}: ^{roomReferenceWidget room}
+
$of more
_{MsgScheduleRooms}: #
$forall (mRoom,showRoom) <- more
$if showRoom
- ^{maybe mempty roomReferenceWidget mRoom}
+ $maybe room <- mRoom
+ ^{roomReferenceWidget room}
_{MsgScheduleOccur}: #
$if Just (utctDay seoStart) == fmap utctDay seoEnd