feat(exams): improve occurrence display

This commit is contained in:
Gregor Kleen 2020-01-29 22:53:35 +01:00
parent 45506bd773
commit 2b56f26c45
4 changed files with 20 additions and 7 deletions

View File

@ -1516,6 +1516,7 @@ ExamParticipantsRegisterHeading: Prüfungsteilnehmer hinzufügen
ExamParticipantsInvited n@Int: #{n} #{pluralDE n "Einladung" "Einladungen"} per E-Mail verschickt
ExamName: Name
ExamRoom: Raum
ExamTime: Termin
ExamsHeading: Prüfungen
ExamNameTip: Muss innerhalb der Veranstaltung eindeutig sein
@ -1587,11 +1588,11 @@ ExamRoomFifo': Auswahl durch Teilnehmer bei Anmeldung
ExamOccurrence: Termin/Raum
ExamNoOccurrence: Kein Termin/Raum
ExamNoSuchOccurrence: Termin/Raum existiert nicht (mehr)
ExamOccurrences: Prüfungen
ExamOccurrences: Termine
ExamRooms: Räume
ExamTimes: Termine
ExamRoomAlreadyExists: Prüfung ist bereits eingetragen
ExamRoomName: Interne Bezeichnung
ExamRoom: Raum
ExamRoomCapacity: Kapazität
ExamRoomCapacityNegative: Kapazität darf nicht negativ sein
ExamRoomTime: Termin

View File

@ -1514,6 +1514,7 @@ ExamParticipantsRegisterHeading: Add exam participants
ExamParticipantsInvited n: #{n} #{pluralEN n "invitation" "invitations"} sent via email
ExamName: Name
ExamRoom: Room
ExamTime: Time
ExamsHeading: Exams
ExamNameTip: Needs to be unique within the course
@ -1587,9 +1588,9 @@ ExamNoOccurrence: No occurrence/room
ExamNoSuchOccurrence: Occurrence/Room does not exist (anymore)
ExamOccurrences: Exams
ExamRooms: Rooms
ExamTimes: Times
ExamRoomAlreadyExists: Occurrence already configured
ExamRoomName: Internal name
ExamRoom: Room
ExamRoomCapacity: Capacity
ExamRoomCapacityNegative: Capacity may not be negative
ExamRoomTime: Time

View File

@ -103,6 +103,10 @@ getEShowR tid ssh csh examn = do
fmap (Just occId, ) . hasWriteAccessTo . CExamR tid ssh csh examName $ ERegisterOccR examOccurrenceName
let examTimes = all (\(Entity _ ExamOccurrence{..}, _) -> Just examOccurrenceStart == examStart && examOccurrenceEnd == examEnd) occurrences
examRoom = do
Entity _ primeOcc <- occurrences ^? _head . _1
guard $ all (\(Entity _ occ, _) -> examOccurrenceRoom occ == examOccurrenceRoom primeOcc) occurrences
return $ examOccurrenceRoom primeOcc
registerWidget mOcc
| isRegistered <- is _Just $ join registered
, examOccurrenceRule /= ExamRoomFifo || (isRegistered && not (any snd occurrences))

View File

@ -47,6 +47,9 @@ $maybe desc <- examDescription
$maybe publishAssignments <- examPublishOccurrenceAssignments
<dt .deflist__dt>_{MsgExamPublishOccurrenceAssignmentsParticipant}
<dd .deflist__dd>^{formatTimeW SelFormatDateTime publishAssignments}
$maybe room <- examRoom
<dt .deflist__dt>_{MsgExamRoom}
<dd .deflist__dd>#{room}
$if examTimes
<dt .deflist__dt>_{MsgExamTime}
<dd .deflist__dd>
@ -106,9 +109,11 @@ $if not (null occurrences)
<section>
<h2>
$if examTimes
_{MsgExamOccurrences}
$else
_{MsgExamRooms}
$elseif is _Just examRoom
_{MsgExamTimes}
$else
_{MsgExamOccurrences}
<table .table .table--striped .table--hover>
<thead>
<tr .table__row .table__row--head>
@ -116,7 +121,8 @@ $if not (null occurrences)
<th .table__th>
_{MsgExamRoomName}
\ ^{isVisible False}
<th .table__th>_{MsgExamRoom}
$if is _Nothing examRoom
<th .table__th>_{MsgExamRoom}
$if not examTimes
<th .table__th>_{MsgExamRoomTime}
$if showOccurrenceRegisterColumn
@ -151,7 +157,8 @@ $if not (null occurrences)
<tr .table__row :markUnregisteredOccurrences (Just occurrence) && not registered:.occurrence--not-registered>
$if occurrenceNamesShown
<td .table__td #exam-occurrence__#{examOccurrenceName}>#{examOccurrenceName}
<td .table__td>#{examOccurrenceRoom}
$if is _Nothing examRoom
<td .table__td>#{examOccurrenceRoom}
$if not examTimes
<td .table__td>
^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd}