From 6fbb2eabf1c90d3ab4e321773506ff8aebbb761d Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Thu, 6 Aug 2020 09:09:27 +0200 Subject: [PATCH] feat(course-visibility): more precise description on CShowR --- messages/uniworx/de-de-formal.msg | 3 ++- messages/uniworx/en-eu.msg | 3 ++- src/Handler/Course/Show.hs | 10 +++++----- templates/course.hamlet | 7 +++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/messages/uniworx/de-de-formal.msg b/messages/uniworx/de-de-formal.msg index c3f54382b..5a8f7eeb5 100644 --- a/messages/uniworx/de-de-formal.msg +++ b/messages/uniworx/de-de-formal.msg @@ -116,7 +116,8 @@ TutorialNoCapacity: In dieser Übung sind keine Plätze mehr frei. ExamOccurrenceNoCapacity: Zu diesem Termin/Raum sind keine Plätze mehr frei. CourseNotEmpty: In diesem Kurs sind momentan Teilnehmer angemeldet. CourseVisibility: Sichtbarkeit -CourseInvisible: Dieser Kurs ist momentan nur für Dozenten, Assistenten, Tutoren, Korrektoren und angemeldete Teilnehmer sichtbar. +CourseInvisible: Dieser Kurs ist momentan nur für Dozenten, Assistenten, Tutoren, Korrektoren, angemeldete Teilnehmer und Bewerber sichtbar. +CourseInvisibleOverridenByAllocation: Da die Zentralanmeldung, an welcher der Kurs teilnimmt aktuell offen für Bewerbungen ist, wird die Kurssichtbarkeit während der Bewerbungsphase forciert. Außerhalb der Bewerbungsphase ist der Kurs nur für Dozenten, Assistenten, Tutoren, Korrektoren, angemeldete Teilnehmer und Bewerber sichtbar. CourseRegistration: Kursanmeldung CourseRegisterOpen: Anmeldung möglich CourseRegisterOk: Erfolgreich zum Kurs angemeldet diff --git a/messages/uniworx/en-eu.msg b/messages/uniworx/en-eu.msg index f3152fdf8..3626531bd 100644 --- a/messages/uniworx/en-eu.msg +++ b/messages/uniworx/en-eu.msg @@ -116,7 +116,8 @@ TutorialNoCapacity: Tutorial has reached maximum capacity ExamOccurrenceNoCapacity: Occurrence/Room has reached maximum capacity CourseNotEmpty: There are currently no participants enrolled for this course. CourseVisibility: Visibility -CourseInvisible: This course is currently only visible to lecturers, assistants, tutors, correctors and enrolled participants. +CourseInvisible: This course is currently only visible to lecturers, assistants, tutors, correctors, enrolled participants and applicants. +CourseInvisibleOverridenByAllocation: Because the allocation this course participates in is currently open for application, the course visibility is currently forced. After the application phase, the course is only visible to lecturers, assistants, tutors, correctors, enrolled participants and applicants. CourseRegistration: Enrolment CourseRegisterOpen: Enrolment is allowed CourseRegisterOk: Successfully enrolled for course diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index a9f618015..2f19c4502 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -28,8 +28,8 @@ getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCShowR tid ssh csh = do mbAid <- maybeAuthId now <- liftIO getCurrentTime - (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup) <- runDB . maybeT notFound $ do - [(E.Entity cid course, E.Value courseVisible, E.Value schoolName, E.Value participants, fmap entityVal -> registration)] + (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen) <- runDB . maybeT notFound $ do + [(E.Entity cid course, E.Value courseVisible, E.Value schoolName, E.Value participants, fmap entityVal -> registration, E.Value hasAllocationRegistrationOpen)] <- lift . E.select . E.from $ \((school `E.InnerJoin` course) `E.LeftOuterJoin` participant) -> do E.on $ E.just (course E.^. CourseId) E.==. participant E.?. CourseParticipantCourse @@ -44,7 +44,7 @@ getCShowR tid ssh csh = do numParticipants = E.subSelectCount . E.from $ \part -> E.where_ $ part E.^. CourseParticipantCourse E.==. course E.^. CourseId E.&&. part E.^. CourseParticipantState E.==. E.val CourseParticipantActive - return (course, courseIsVisible now course Nothing, school E.^. SchoolName, numParticipants, participant) + return (course, courseIsVisible now course Nothing, school E.^. SchoolName, numParticipants, participant, courseAllocationRegistrationOpen now (course E.^. CourseId) Nothing) staff <- lift . E.select $ E.from $ \(lecturer `E.InnerJoin` user) -> do E.on $ lecturer E.^. LecturerUser E.==. user E.^. UserId E.where_ $ lecturer E.^. LecturerCourse E.==. E.val cid @@ -105,8 +105,8 @@ getCShowR tid ssh csh = do E.where_ $ submissionGroupUser E.^. SubmissionGroupUserUser E.==. E.val uid return $ submissionGroup E.^. SubmissionGroupName let submissionGroup = guardOnM (hasSubmissionGroups && is _Just registration) submissionGroup' - - return (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup) + + return (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen) let mDereg' = maybe id min (allocationOverrideDeregister =<< mAllocation) <$> courseDeregisterUntil course mDereg <- traverse (formatTime SelFormatDateTime) mDereg' diff --git a/templates/course.hamlet b/templates/course.hamlet index 9448eb41f..db30a590b 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -136,8 +136,11 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
$maybe visFrom <- courseVisibleFrom ^{formatTimeRangeW SelFormatDateTime visFrom courseVisibleTo} - $nothing - _{MsgCourseInvisible} + $if NTop (Just now) < NTop courseVisibleFrom + $if hasAllocationRegistrationOpen + _{MsgCourseInvisibleOverridenByAllocation} + $else + _{MsgCourseInvisible} $maybe (Allocation{allocationName, allocationRegisterByCourse}, url) <- mAllocation'