fix(schedule): fix display of unset and hidden room info
This commit is contained in:
parent
6b8a140aca
commit
c1b94dbb53
@ -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
|
||||
}
|
||||
|
||||
@ -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)])
|
||||
|
||||
@ -32,12 +32,9 @@ $newline never
|
||||
(_{MsgScheduleWeekSlotIsCont})
|
||||
<br>
|
||||
$if sceShowRoom
|
||||
_{MsgScheduleRoom}: #
|
||||
$maybe room <- sceRoom
|
||||
^{roomReferenceWidget room}
|
||||
$nothing
|
||||
_{MsgCourseEventRoomIsUnset}
|
||||
<br>
|
||||
^_{MsgScheduleRoom}: ^{roomReferenceWidget room}
|
||||
<br>
|
||||
^{formatEitherOccurrenceW sceOccurrence}
|
||||
$of ScheduleTutorial{stCourse=Entity _ Course{courseName},stName,stType,stRoom,stShowRoom,stOccurrence}
|
||||
#{CI.original courseName}: #{stName} #
|
||||
@ -48,28 +45,28 @@ $newline never
|
||||
)
|
||||
<br>
|
||||
$if stShowRoom
|
||||
_{MsgScheduleRoom}: #
|
||||
$maybe room <- stRoom
|
||||
^{roomReferenceWidget room}
|
||||
$nothing
|
||||
_{MsgTutorialRoomIsUnset}
|
||||
<br>
|
||||
_{MsgScheduleRoom}: ^{roomReferenceWidget room}
|
||||
<br>
|
||||
^{formatEitherOccurrenceW stOccurrence}
|
||||
$of ScheduleExamOccurrence{seoCourse=Entity _ Course{courseName},seoExamName,seoRooms,seoStart,seoEnd}
|
||||
#{CI.original courseName}: #{seoExamName}
|
||||
$if slotAssocIsCont slotAssociation
|
||||
(_{MsgScheduleWeekSlotIsCont})
|
||||
<br>
|
||||
$case toList seoRooms
|
||||
$of [(mRoom,showRoom)]
|
||||
$case Set.toList seoRooms
|
||||
$of []
|
||||
$of [(mRoom, showRoom)]
|
||||
$if showRoom
|
||||
_{MsgScheduleRoom}: ^{maybe mempty roomReferenceWidget mRoom}
|
||||
<br>
|
||||
$maybe room <- mRoom
|
||||
_{MsgScheduleRoom}: ^{roomReferenceWidget room}
|
||||
<br>
|
||||
$of more
|
||||
_{MsgScheduleRooms}: #
|
||||
$forall (mRoom,showRoom) <- more
|
||||
$if showRoom
|
||||
^{maybe mempty roomReferenceWidget mRoom}
|
||||
$maybe room <- mRoom
|
||||
^{roomReferenceWidget room}
|
||||
<br>
|
||||
_{MsgScheduleOccur}: #
|
||||
$if Just (utctDay seoStart) == fmap utctDay seoEnd
|
||||
|
||||
Reference in New Issue
Block a user