From b7c54df9132b3759b3957dec4f09f6250b2f4623 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 5 Oct 2019 15:24:13 +0200 Subject: [PATCH] feat(allocations): show more information --- messages/uniworx/de.msg | 10 +++++ src/Handler/Allocation/Show.hs | 18 +++++--- templates/allocation/show.hamlet | 53 +++++++++++++++++++----- templates/allocation/show.lucius | 14 +++++-- templates/allocation/show/course.hamlet | 4 ++ templates/i18n/allocation-info/de.hamlet | 15 ++++--- 6 files changed, 87 insertions(+), 27 deletions(-) diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index 06da292cd..0b9f793ac 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -1642,7 +1642,10 @@ AllocationAppliedCourses: Bewerbungen AllocationNumCoursesAvailableApplied available@Int applied@Int: Sie haben sich bisher für #{applied}/#{available} #{pluralDE applied "Kurs" "Kursen"} beworben AllocationTitle termText@Text ssh'@SchoolShorthand allocation@AllocationName: #{termText} - #{ssh'}: #{allocation} AllocationShortTitle termText@Text ssh'@SchoolShorthand ash@AllocationShorthand: #{termText} - #{ssh'} - #{ash} +AllocationSchool: Institut +AllocationSemester: Semester AllocationDescription: Beschreibung +AllocationStaffDescription: Beschreibung für Dozenten AllocationStaffRegisterFrom: Eintragung der Kurse ab AllocationStaffRegister: Eintragung der Kurse AllocationRegisterFrom: Bewerbung ab @@ -1651,6 +1654,13 @@ AllocationRegisterClosed: Die Zentralanmeldung ist aktuell geschlossen. AllocationRegisterOpensIn difftime@Text: Die Zentralanmeldung öffnet voraussichtlich in #{difftime} AllocationStaffAllocationFrom: Bewertung der Bewerbungen ab AllocationStaffAllocation: Bewertung der Bewerbungen +AllocationRegisterByStaff: An- und Abmeldung durch Kursverwalter +AllocationRegisterByStaffFrom: An- und Abmeldung durch Kursverwalter ab +AllocationRegisterByStaffTip: In diesem Zeitraum können Kursverwalter Teilnehmer zu und von ihren Kursen an- und abmelden. +AllocationRegisterByStaffFromTip: Ab diesem Zeitpunkt können Kursverwalter Teilnehmer zu und von ihren Kursen an- und abmelden. +AllocationRegisterByCourseFrom: Direkte An- und Abmeldung ab +AllocationRegisterByCourseFromTip: Frühestens ab diesem Zeitpunkt ist die eigentständige An- und Abmeldung zu und von den Kursen, die an der Zentralanmeldung teilnehmen, möglich. Kontrolle über die genauen Fristen haben die Kursverwalter. +AllocationOverrideDeregister: Abmeldung von den Kursen nur bis AllocationProcess: Platzvergabe AllocationNoApplication: Keine Bewerbung AllocationPriority: Priorität diff --git a/src/Handler/Allocation/Show.hs b/src/Handler/Allocation/Show.hs index 3d366d129..5d0adf9de 100644 --- a/src/Handler/Allocation/Show.hs +++ b/src/Handler/Allocation/Show.hs @@ -23,11 +23,16 @@ getAShowR tid ssh ash = do resultCourseApplication = _2 . _Just resultHasTemplate :: Simple Field3 a (E.Value Bool) => Lens' a Bool resultHasTemplate = _3 . _Value + resultIsRegistered :: Simple Field4 a (E.Value Bool) => Lens' a Bool + resultIsRegistered = _4 . _Value - (Entity aId Allocation{..}, courses, registration) <- runDB $ do - alloc@(Entity aId _) <- getBy404 $ TermSchoolAllocationShort tid ssh ash + (Entity aId Allocation{..}, School{..}, isAnyLecturer, courses, registration) <- runDB $ do + alloc@(Entity aId Allocation{allocationSchool}) <- getBy404 $ TermSchoolAllocationShort tid ssh ash + school <- getJust allocationSchool - courses <- E.select . E.from $ \((allocationCourse `E.InnerJoin` course) `E.LeftOuterJoin` courseApplication) -> do + courses <- E.select . E.from $ \((allocationCourse `E.InnerJoin` course) `E.LeftOuterJoin` courseApplication `E.LeftOuterJoin` registration) -> do + E.on $ registration E.?. CourseParticipantCourse E.==. E.just (course E.^. CourseId) + E.&&. registration E.?. CourseParticipantUser E.==. E.val muid E.on $ courseApplication E.?. CourseApplicationCourse E.==. E.just (course E.^. CourseId) E.&&. courseApplication E.?. CourseApplicationUser E.==. E.val muid E.&&. courseApplication E.?. CourseApplicationAllocation E.==. E.just (E.just $ E.val aId) @@ -36,11 +41,13 @@ getAShowR tid ssh ash = do E.orderBy [E.asc $ course E.^. CourseName] let hasTemplate = E.exists . E.from $ \courseAppInstructionFile -> E.where_ $ courseAppInstructionFile E.^. CourseAppInstructionFileCourse E.==. course E.^. CourseId - return (course, courseApplication, hasTemplate) + return (course, courseApplication, hasTemplate, E.not_ . E.isNothing $ registration E.?. CourseParticipantId) registration <- fmap join . for muid $ getBy . UniqueAllocationUser aId - return (alloc, nubOn (view $ resultCourse . _entityKey) courses, registration) + isAnyLecturer <- hasWriteAccessTo CourseNewR + + return (alloc, school, isAnyLecturer, nubOn (view $ resultCourse . _entityKey) courses, registration) MsgRenderer mr <- getMsgRenderer let title = MsgAllocationTitle (mr . ShortTermIdentifier $ unTermKey allocationTerm) (unSchoolKey allocationSchool) allocationName @@ -68,6 +75,7 @@ getAShowR tid ssh ash = do let Entity cid Course{..} = cEntry ^. resultCourse hasApplicationTemplate = cEntry ^. resultHasTemplate mApp = cEntry ^? resultCourseApplication + isRegistered = cEntry ^. resultIsRegistered cID <- encrypt cid :: WidgetFor UniWorX CryptoUUIDCourse mayApply <- hasWriteAccessTo . AllocationR tid ssh ash $ AApplyR cID isLecturer <- hasWriteAccessTo $ CourseR courseTerm courseSchool courseShorthand CEditR diff --git a/templates/allocation/show.hamlet b/templates/allocation/show.hamlet index 3f0e97fe1..f6a2312a3 100644 --- a/templates/allocation/show.hamlet +++ b/templates/allocation/show.hamlet @@ -1,13 +1,24 @@ $newline never
- $#

- $# _{MsgAllocationData}
+
+ _{MsgAllocationSemester} +
+ _{unTermKey allocationTerm} +
+ _{MsgAllocationSchool} +
+ #{schoolName} $maybe desc <- allocationDescription
_{MsgAllocationDescription}
#{desc} + $maybe desc <- guardOn isAnyLecturer =<< allocationStaffDescription +
+ _{MsgAllocationStaffDescription} +
+ #{desc} $maybe fromT <- allocationStaffRegisterFrom
$maybe _ <- allocationStaffRegisterTo @@ -32,14 +43,36 @@ $newline never _{MsgAllocationStaffAllocationFrom}
^{formatTimeRangeW SelFormatDateTime fromT allocationStaffAllocationTo} - - $# TODO show datetime of automatic allocation - $# - $#
- $# _{MsgAllocationProcess} - $#
- $# ^{formatTimeRangeW SelFormatDateTime fromT allocationProcess} - $# + $maybe fromT <- allocationRegisterByStaffFrom +
+ $maybe _ <- allocationRegisterByStaffTo + _{MsgAllocationRegisterByStaff} + + + + _{MsgAllocationRegisterByStaffTip} + $nothing + _{MsgAllocationRegisterByStaffFrom} + + + + _{MsgAllocationRegisterByStaffFromTip} +
+ ^{formatTimeRangeW SelFormatDateTime fromT allocationRegisterByStaffTo} + $maybe fromT <- allocationRegisterByCourse +
+ _{MsgAllocationRegisterByCourseFrom} + + + + _{MsgAllocationRegisterByCourseFromTip} +
+ ^{formatTimeW SelFormatDateTime fromT} + $maybe toT <- allocationOverrideDeregister +
+ _{MsgAllocationOverrideDeregister} +
+

^{formatTimeW SelFormatDateTime toT}

diff --git a/templates/allocation/show.lucius b/templates/allocation/show.lucius index 54e085ed3..5302b59a4 100644 --- a/templates/allocation/show.lucius +++ b/templates/allocation/show.lucius @@ -17,10 +17,11 @@ display: grid; grid-template-columns: minmax(105px, 1fr) 9fr; grid-template-areas: - 'name name ' - 'prio-label prio ' - 'instr-label instr ' - 'form-label form '; + 'name name ' + '. registered ' + 'prio-label prio ' + 'instr-label instr ' + 'form-label form '; grid-gap: 5px 7px; margin: 12px 0; @@ -41,6 +42,10 @@ background-color: rgba(0, 0, 0, 0.015); } + .allocation-course__registered { + grid-area: registered; + } + .allocation-course__priority { grid-area: prio; } @@ -84,6 +89,7 @@ grid-template-columns: 1fr; grid-template-areas: 'name ' + 'registered ' 'prio-label ' 'prio ' 'instr-label' diff --git a/templates/allocation/show/course.hamlet b/templates/allocation/show/course.hamlet index 53992eed4..4972ae661 100644 --- a/templates/allocation/show/course.hamlet +++ b/templates/allocation/show/course.hamlet @@ -1,3 +1,7 @@ +$if isRegistered +
+ #{iconOK} + \ _{MsgRegistered} $if is _Just muid
_{MsgAllocationPriority} diff --git a/templates/i18n/allocation-info/de.hamlet b/templates/i18n/allocation-info/de.hamlet index 3a251e91e..751af12b5 100644 --- a/templates/i18n/allocation-info/de.hamlet +++ b/templates/i18n/allocation-info/de.hamlet @@ -29,12 +29,13 @@ $newline text Studierende können sich nur in diesem Zeitraum auf Plätze in Kursen einer Zentralanmeldung bewerben.

- Bewerber können jedem Kurs der Zentralanmeldung eine Priorität - zuweisen, zwischen "dieser Kurs wäre meine erste Wahl" - und "diesen Kurs besuche ich auf keinen Fall". + Bewerber können jedem Kurs der Zentralanmeldung eine Priorität zuweisen, + zwischen "dieser Kurs wäre meine erste Wahl" und "diesen Kurs besuche + ich nur, wenn ich keinen anderen Platz kriege". Es kann auch mehreren Kursen die gleiche Priorität eingeräumt werden.

- Bewerbungen für und Prioritisierung der Kurse können innerhalb des Bewerbungszeitraums beliebig angepasst und zurückgezogen werden. + Bewerbungen für und Prioritisierung der Kurse können innerhalb des + Bewerbungszeitraums beliebig angepasst und zurückgezogen werden.

Studierende können auch mehr als einen Platz in verschiedenen Kursen einer Zentralanmeldung anfordern, @@ -64,7 +65,6 @@ $newline text und der Bewertung durch den Veranstalter auf die Bewerber verteilt.

Die Bewerber werden diekt in den jeweiligen Kursen angemeldet. - Eine Abmeldung durch Studierende ist nicht erlaubt. Übernommene Bewerber, welche einen zugeteilten Platz ohne Angabe eines triftigen Grundes nicht antreten, werden in zukünftigen Zentralanmeldungen @@ -78,9 +78,8 @@ $newline text Der Ablauf einer Zentralanmeldung kann unter Umständen noch variieren. Insbesondere: # - Fehlt in der Übersichtsseite einer Zentralanmeldung - die Angabe einer dieser Phasen, dann wurde der entsprechende Zeitraum - leider noch nicht festgelegt! + Fehlt in der Übersichtsseite einer Zentralanmeldung die Angabe einer dieser + Phasen, dann wurden die entsprechenden Zeiten noch nicht festgelegt!

Mehrere Zentralanmeldungen werden völlig unabhängig voneinander abgewickelt.