$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 examClosedShown $maybe closed <- examClosed
_{MsgExamClosed} ^{isVisible False}
^{formatTimeW SelFormatDateTime closed} $if gradingShown $maybe gradingRule <- examGradingRule
_{MsgExamGradingRule} $if not gradingVisible \ ^{isVisible False}
$case gradingRule $of ExamGradingKey{..} ^{gradingKeyW examGradingKey} $maybe bonusRule <- examBonusRule
_{MsgExamBonusRule} $if not gradingVisible \ ^{isVisible False}
^{examBonusW bonusRule} $if examOccurrenceRule /= ExamRoomManual $if occurrenceAssignmentsShown
_{MsgExamOccurrenceRuleParticipant} $if not occurrenceAssignmentsVisible \ ^{isVisible False}
_{classifyExamOccurrenceRule examOccurrenceRule} $maybe registerWdgt <- registerWidget Nothing
_{MsgExamRegistration}
^{registerWdgt} $if not (null occurrences)

$if examTimes _{MsgExamOccurrences} $else _{MsgExamRooms} $if occurrenceNamesShown $forall (occurrence, registered) <- occurrences $with Entity _occId ExamOccurrence{examOccurrenceName, examOccurrenceRoom, examOccurrenceStart, examOccurrenceEnd, examOccurrenceDescription} <- occurrence $with registerWdgt <- registerWidget (Just occurrence) $if occurrenceNamesShown
_{MsgExamRoomName} \ ^{isVisible False} _{MsgExamRoom} $if not examTimes _{MsgExamRoomTime} $if showOccurrenceRegisterColumn $if examOccurrenceRule == ExamRoomFifo _{MsgExamRoomRegistered} $else _{MsgExamRoomAssigned} $if not occurrenceAssignmentsVisible \ ^{isVisible False} _{MsgExamRoomDescription}
#{examOccurrenceName} #{examOccurrenceRoom} $if not examTimes ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} $if showOccurrenceRegisterColumn $maybe registerWdgt' <- registerWdgt ^{registerWdgt'} $nothing $if registered #{iconOK} $maybe desc <- examOccurrenceDescription #{desc} $if gradingShown && not (null examParts)

_{MsgExamParts} $if gradingShown && not gradingVisible \ ^{isVisible False} $if partNumbersShown $forall Entity partId ExamPart{examPartNumber, examPartName, examPartWeight, examPartMaxPoints} <- examParts $if partNumbersShown $maybe mPoints <- fmap (examBonusBonus . entityVal) bonus $if showMaxPoints $if partNumbersShown $if partNumbersShown $if partNumbersShown $if partNumbersShown
_{MsgExamPartNumber} ^{isVisible False} _{MsgExamPartName} $if showMaxPoints _{MsgExamPartMaxPoints} $if showAchievedPoints _{MsgExamPartResultPoints}
#{examPartNumber} $maybe pName <- examPartName #{pName} $nothing _{MsgExamPartNumbered examPartNumber} $if showMaxPoints $maybe mPoints <- examPartMaxPoints #{showFixed True (fromRational examPartWeight * mPoints)} $if showAchievedPoints $case fmap (examPartResultResult . entityVal) (results !? partId) $of Nothing $of Just (ExamAttended ps) #{showFixed True ps} $of Just ExamNoShow _{MsgExamNoShow} $of Just ExamVoided _{MsgExamVoided}
#{showFixed True sumMaxPoints}
_{MsgExamBonusAchieved} $if showMaxPoints $if showAchievedPoints #{showFixed True mPoints}
$if showMaxPoints $if showAchievedPoints $case sumPoints $of ExamAttended ps #{showFixed True ps} $of _ $nothing
$if showMaxPoints #{showFixed True sumMaxPoints} $if showAchievedPoints $case sumPoints $of ExamAttended ps #{showFixed True ps} $of _ $# TODO: Statistics