fradrive/templates/exam-show.hamlet
2019-06-26 17:33:55 +02:00

154 lines
5.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$newline never
$maybe Entity _ ExamResult{examResultResult} <- result
$if gradingShown
<section>
<h2>
_{MsgExamResult}
$if gradingShown && not gradingVisible
\ ^{isVisible False}
<p .result>
$case examResultResult
$of ExamAttended grade
$if examShowGrades
_{grade}
$else
$if passingGrade grade
_{MsgExamPassed}
$else
_{MsgExamNotPassed}
$of ExamNoShow
_{MsgExamNoShow}
$of ExamVoided
_{MsgExamVoided}
$maybe desc <- examDescription
<section>
#{desc}
<section>
<dl .deflist>
$if not examVisible
<dt .deflist__dt>_{MsgExamVisibleFrom}
<dd .deflist__dd>
$maybe from <- examVisibleFrom
^{formatTimeW SelFormatDateTime from}
$nothing
_{MsgNever}
\ ^{isVisible False}
$maybe regFrom <- examRegisterFrom
<dt .deflist__dt>_{MsgExamRegisterFrom}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime regFrom}
$maybe regTo <- examRegisterTo
<dt .deflist__dt>_{MsgExamRegisterTo}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime regTo}
$maybe deregUntil <- examDeregisterUntil
<dt .deflist__dt>_{MsgExamDeregisterUntil}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime deregUntil}
<dt .deflist__dt>_{MsgExamPublishOccurrenceAssignmentsParticipant}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime examPublishOccurrenceAssignments}
$if examTimes
<dt .deflist__dt>_{MsgExamTime}
<dd .deflist__dd>
^{formatTimeW SelFormatDateTime examStart}
$maybe end <- examEnd
\ ^{formatTimeW (bool SelFormatDateTime SelFormatTime ((on (==) utctDay) examStart end)) end}
$maybe finished <- examFinished
<dt .deflist__dt>_{MsgExamFinishedParticipant}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime finished}
$if gradingShown
$if examGradingRule /= ExamGradingManual
<dt .deflist__dt>
_{MsgExamGradingRule}
$if not gradingVisible
\ ^{isVisible False}
<dd .deflist__dd>
$case examGradingRule
$of ExamGradingManual
_{MsgExamGradingManual'}
$of ExamGradingKey{..}
^{gradingKeyW examGradingKey}
$if examBonusRule /= ExamNoBonus
<dt .deflist__dt>
_{MsgExamBonusRule}
$if not gradingVisible
\ ^{isVisible False}
<dd .deflist__dd>
^{examBonusW examBonusRule}
$if occurrenceAssignmentsShown
<dt .deflist__dt>
_{MsgExamOccurrenceRuleParticipant}
$if not occurrenceAssignmentsVisible
\ ^{isVisible False}
<dd .deflist__dd>
$# TODO
$maybe registerWdgt <- registerWidget
<dt .deflist__dt>_{MsgExamRegistration}
<dd .deflist__dd>^{registerWdgt}
$if not (null occurrences)
<section>
<h2>
_{MsgExamOccurrences}
<table .table .table--striped .table--hover>
<thead>
<tr .table__row .table__row--head>
<th .table__th>_{MsgExamRoom}
$if not examTimes
<th .table__th>_{MsgExamRoomTime}
<th .table__th>_{MsgExamRoomDescription}
$if occurrenceAssignmentsShown
<th .table__th>
_{MsgExamRoomRegistered}
$if not occurrenceAssignmentsVisible
\ ^{isVisible False}
<tbody>
$forall (Entity _occId ExamOccurrence{examOccurrenceRoom, examOccurrenceStart, examOccurrenceEnd, examOccurrenceDescription}, registered) <- occurrences
<tr .table__row :occurrenceAssignmentsShown && not registered:.occurrence--not-registered>
<td .table__td>#{examOccurrenceRoom}
$if not examTimes
<td .table__td>
^{formatTimeW SelFormatDateTime examOccurrenceStart}
$maybe end <- examOccurrenceEnd
\ ^{formatTimeW (bool SelFormatDateTime SelFormatTime ((on (==) utctDay) examStart end)) end}
<td .table__td>
$maybe desc <- examOccurrenceDescription
#{desc}
$if occurrenceAssignmentsShown
<td .table__td>
$if registered
#{fontAwesomeIcon "check"}
$if gradingShown && not (null parts)
<section>
<h2>
_{MsgExamParts}
$if gradingShown && not gradingVisible
\ ^{isVisible False}
<table .table .table--striped .table--hover >
<thead>
<tr .table__row .table__row--head>
<th .table__th>_{MsgExamPartName}
<th .table__th>_{MsgExamPartMaxPoints}
<th .table__th>_{MsgExamPartResultPoints}
<tbody>
$forall Entity partId ExamPart{examPartName, examPartWeight, examPartMaxPoints} <- parts
<tr .table__row>
<td .table__td>#{examPartName}
<td .table__td>
$maybe mPoints <- examPartMaxPoints
#{showFixed True (fromRational examPartWeight * mPoints)}
<td .table__td>
$case fmap (examPartResultResult . entityVal) (results !? partId)
$of Nothing
$of Just (ExamAttended (Just ps))
#{showFixed True ps}
$of Just (ExamAttended Nothing)
#{fontAwesomeIcon "check"}
$of Just ExamNoShow
_{MsgExamNoShow}
$of Just ExamVoided
_{MsgExamVoided}
$# TODO: Statistics