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

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

$case examResultResult $of ExamAttended grade _{grade} $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} $maybe room <- examRoom
_{MsgExamRoom}
#{room} $if examTimes
_{MsgExamTime}
$maybe start <- examStart ^{formatTimeRangeW SelFormatDateTime start examEnd} $maybe finished <- examFinished
_{examFinishedMsg}
^{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} $if showRegisteredCount
_{MsgExamRegisteredCount}
#{registeredCount} $maybe registerWdgt <- registerWidget Nothing
_{MsgExamRegistration} \ ^{isVisible False}
^{registerWdgt} $if showCloseWidget && is _Nothing examClosed

_{MsgExamCloseHeading} \ ^{isVisible False} ^{closeWgt} $if examOccurrenceRuleAutomatic examOccurrenceRule && showAutoOccurrenceCalculateWidget

_{MsgExamAutoOccurrenceHeading} \ ^{isVisible False} ^{examAutoOccurrenceCalculateWidget tid ssh csh examn} $if not (null occurrences)

$if examTimes _{MsgExamRooms} $elseif is _Just examRoom _{MsgExamTimes} $else _{MsgExamOccurrences} $if occurrenceNamesShown $forall (occurrence, registered, rCount) <- occurrences $with Entity _occId ExamOccurrence{examOccurrenceName, examOccurrenceRoom, examOccurrenceStart, examOccurrenceEnd, examOccurrenceDescription} <- occurrence $with registerWdgt <- registerWidget (Just occurrence) $if occurrenceNamesShown $if occurrenceNamesShown
_{MsgExamRoomName} \ ^{isVisible False} $if is _Nothing examRoom _{MsgExamRoom} $if not examTimes _{MsgExamRoomTime} $if showOccurrenceRegisterColumn $if examOccurrenceRule == ExamRoomFifo _{MsgExamRoomRegistered} $else _{MsgExamRoomAssigned} $if not occurrenceAssignmentsVisible \ ^{isVisible False} $if showOccurrenceMappingColumn $case fmap examOccurrenceMappingRule examExamOccurrenceMapping $of Just ExamRoomSurname _{MsgExamRoomMappingSurname} $if not occurrenceAssignmentsVisible \ ^{isVisible False} $of Just ExamRoomMatriculation _{MsgExamRoomMappingMatriculation} $if not occurrenceAssignmentsVisible \ ^{isVisible False} $of _ $if not occurrenceAssignmentsVisible ^{isVisible False} $if showRegisteredCount _{MsgExamRegisteredCount} \ ^{isVisible False} _{MsgExamRoomDescription}
#{examOccurrenceName} $if is _Nothing examRoom #{examOccurrenceRoom} $if not examTimes ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} $if showOccurrenceRegisterColumn $maybe registerWdgt' <- registerWdgt ^{registerWdgt'} $nothing $if registered #{iconOK} $if showOccurrenceMappingColumn $maybe mappingWgt <- occurrenceMapping examOccurrenceName ^{mappingWgt} $if showRegisteredCount #{rCount} $maybe desc <- examOccurrenceDescription #{desc}
$if is _Nothing examRoom $if not examTimes $if showOccurrenceRegisterColumn $if showOccurrenceMappingColumn $if showRegisteredCount $if sumRegisteredCount == registeredCount #{sumRegisteredCount} $else _{MsgExamRegisteredCountOf sumRegisteredCount registeredCount} $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