$newline never $maybe Entity _ ExamResult{examResultResult} <- result $if gradingShown

_{MsgExamResult} $if gradingShown && not gradingVisible \ ^{isVisible False}

$case examResultResult $of ExamAttended grade $if examShowGrades _{grade} $else $if view (passingGrade . _Wrapped) grade _{MsgExamPassed} $else _{MsgExamNotPassed} $of ExamNoShow _{MsgExamNoShow} $of ExamVoided _{MsgExamVoided} $maybe desc <- examDescription

#{desc}
$if not examVisible
_{MsgExamVisibleFrom}
$maybe from <- examVisibleFrom ^{formatTimeW SelFormatDateTime from} $nothing _{MsgNever} \ ^{isVisible False} $maybe regFrom <- examRegisterFrom
_{MsgExamRegisterFrom}
^{formatTimeW SelFormatDateTime regFrom} $maybe regTo <- examRegisterTo
_{MsgExamRegisterTo}
^{formatTimeW SelFormatDateTime regTo} $maybe deregUntil <- examDeregisterUntil
_{MsgExamDeregisterUntil}
^{formatTimeW SelFormatDateTime deregUntil} $maybe publishAssignments <- examPublishOccurrenceAssignments
_{MsgExamPublishOccurrenceAssignmentsParticipant}
^{formatTimeW SelFormatDateTime publishAssignments} $if examTimes
_{MsgExamTime}
$maybe start <- examStart ^{formatTimeRangeW SelFormatDateTime start examEnd} $maybe finished <- examFinished
_{MsgExamFinishedParticipant}
^{formatTimeW SelFormatDateTime finished} $if gradingShown $if examGradingRule /= ExamGradingManual
_{MsgExamGradingRule} $if not gradingVisible \ ^{isVisible False}
$case examGradingRule $of ExamGradingManual _{MsgExamGradingManual'} $of ExamGradingKey{..} ^{gradingKeyW examGradingKey} $if examBonusRule /= ExamNoBonus
_{MsgExamBonusRule} $if not gradingVisible \ ^{isVisible False}
^{examBonusW examBonusRule} $if occurrenceAssignmentsShown
_{MsgExamOccurrenceRuleParticipant} $if not occurrenceAssignmentsVisible \ ^{isVisible False}
$# TODO $maybe registerWdgt <- registerWidget
_{MsgExamRegistration}
^{registerWdgt} $if not (null occurrences)

$if examTimes _{MsgExamOccurrences} $else _{MsgExamRooms} $if occurrenceNamesShown $forall (Entity _occId ExamOccurrence{examOccurrenceName, examOccurrenceRoom, examOccurrenceStart, examOccurrenceEnd, examOccurrenceDescription}, registered) <- occurrences $if occurrenceNamesShown
_{MsgExamRoomName} ^{isVisible False} _{MsgExamRoom} $if not examTimes _{MsgExamRoomTime} _{MsgExamRoomDescription} $if occurrenceAssignmentsShown _{MsgExamRoomRegistered} $if not occurrenceAssignmentsVisible \ ^{isVisible False}
#{examOccurrenceName} #{examOccurrenceRoom} $if not examTimes ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} $maybe desc <- examOccurrenceDescription #{desc} $if occurrenceAssignmentsShown $if registered #{iconOK} $if gradingShown && not (null parts)

_{MsgExamParts} $if gradingShown && not gradingVisible \ ^{isVisible False} $forall Entity partId ExamPart{examPartName, examPartWeight, examPartMaxPoints} <- parts
_{MsgExamPartName} _{MsgExamPartMaxPoints} _{MsgExamPartResultPoints}
#{examPartName} $maybe mPoints <- examPartMaxPoints #{showFixed True (fromRational examPartWeight * mPoints)} $case fmap (examPartResultResult . entityVal) (results !? partId) $of Nothing $of Just (ExamAttended ps) #{showFixed True ps} $of Just ExamNoShow _{MsgExamNoShow} $of Just ExamVoided _{MsgExamVoided} $# TODO: Statistics