feat(course-visibility): add visibleFrom,visibleTo

add visibleFrom and visibleTo to model, add fields (CEditR), add info
(CShowR)
This commit is contained in:
Sarah Vaupel 2020-07-24 18:52:54 +02:00
parent 908b1fc234
commit 222d566bda
7 changed files with 50 additions and 3 deletions

View File

@ -53,6 +53,9 @@ RegisterTo: Anmeldungen bis
DeRegUntil: Abmeldungen bis
RegisterRetry: Sie wurden noch nicht angemeldet. Drücken Sie dazu den Knopf "Anmelden"
CourseVisibleFrom: Sichtbar ab
CourseVisibleTo: Sichtbar bis
CourseRegistrationInterval: Anmeldung
CourseDirectRegistrationInterval: Direkte Anmeldung
CourseDeregisterUntil time@Text: Abmeldung nur bis #{time}
@ -112,6 +115,8 @@ CourseNoCapacity: In diesem Kurs sind keine Plätze mehr frei.
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 nicht sichtbar. TODO
CourseRegistration: Kursanmeldung
CourseRegisterOpen: Anmeldung möglich
CourseRegisterOk: Erfolgreich zum Kurs angemeldet
@ -158,6 +163,8 @@ CourseSchoolShort: Institut
CourseSchoolMultipleTip: Es stehen für Sie mehrere Institute zur Auswahl. Stellen Sie bitte sicher, dass Sie das für den Kurs korrekte Institut wählen.
CourseSecretTip: Anmeldung zum Kurs erfordert Eingabe des Passworts, sofern gesetzt
CourseSecretFormat: beliebige Zeichenkette
CourseVisibleFromTip: Ab diesem Zeitpunkt können andere Nutzer (außer Verwalter dieses Kurses) den Kurs sehen. Ohne Datum ist der Kurs nie für andere Nutzer sichtbar.
CourseVisibleToTip: Der Kurs ist ab "Sichtbar ab" bis zu diesem Zeitpunkt für andere Nutzer sichtbar. Ohne Datum bleibt ein sichtbarer Kurs unbegrenzt sichtbar.
CourseRegisterFromTip: Ohne Datum ist keine eigenständige Anmeldung von Studierenden erlaubt.
CourseRegisterToTip: Darf auch unbegrenzt offen bleiben
CourseDeregisterUntilTip: Abmeldung ist ab "Anmeldungen von" bis zu diesem Zeitpunkt erlaubt. Die Abmeldung darf auch unbegrenzt erlaubt bleiben.
@ -2664,4 +2671,4 @@ SubmissionDoneNever: Nie
SubmissionDoneByFile: Je nach Bewertungsdatei
SubmissionDoneAlways: Immer
CorrUploadSubmissionDoneMode: Bewertung abgeschlossen
CorrUploadSubmissionDoneModeTip: Sollen hochgeladene Korrekturen als abgeschlossen markiert werden? Bewertungen sind erst für Studierende sichtbar und zählen gegen Examboni, wenn sie abgeschlossen sind.
CorrUploadSubmissionDoneModeTip: Sollen hochgeladene Korrekturen als abgeschlossen markiert werden? Bewertungen sind erst für Studierende sichtbar und zählen gegen Examboni, wenn sie abgeschlossen sind.

View File

@ -53,6 +53,9 @@ RegisterTo: Enrolment ends
DeRegUntil: Deregistration until
RegisterRetry: You haven't been enrolled. Press "Enrol for course" to enrol
CourseVisibleFrom: Visible from
CourseVisibleTo: Visible to
CourseRegistrationInterval: Enrolment
CourseDirectRegistrationInterval: Direct enrolment
CourseDeregisterUntil time: Deregistration only until #{time}
@ -112,6 +115,8 @@ CourseNoCapacity: Course has reached maximum capacity
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 invisible. TODO
CourseRegistration: Enrolment
CourseRegisterOpen: Enrolment is allowed
CourseRegisterOk: Successfully enrolled for course
@ -158,6 +163,8 @@ CourseSchoolShort: Department
CourseSchoolMultipleTip: You may select from among multiple departments. Please ensure that you select the appropriate department for your course.
CourseSecretTip: Enrollment for this course will require the password, if set
CourseSecretFormat: Arbitrary string
CourseVisibleFromTip: Other users will only be able to see the course from this date onward. When left empty nobody except administrators of this course will be able to see the course.
CourseVisibleToTip: Other users will be able to see the course from "Visible From" up to this date. When left empty visible courses will remain visible indefinitely.
CourseRegisterFromTip: When left empty students will not be able to enrol themselves
CourseRegisterToTip: May be left empty to allow enrolment indefinitely
CourseDeregisterUntilTip: Participants may deregister from immediately after registration starts up to this time. May be left empty to allow deregistration indefinitely.

View File

@ -12,6 +12,8 @@ Course -- Information about a single course; contained info is always visible
school SchoolId
capacity Int Maybe -- number of allowed enrolements, if restricted
-- canRegisterNow = maybe False (<= currentTime) registerFrom && maybe True (>= currentTime) registerTo
visibleFrom UTCTime Maybe default=now() -- course may be visible from a given day onwards or always hidden
visibleTo UTCTime Maybe -- course may be hidden from a given date onwards
registerFrom UTCTime Maybe -- enrolement allowed from a given day onwwards or prohibited
registerTo UTCTime Maybe -- enrolement may be prohibited from a given date onwards
deregisterUntil UTCTime Maybe -- unenrolement may be prohibited from a given date onwards

3
package-lock.json generated
View File

@ -10943,8 +10943,7 @@
"lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=",
"dev": true
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168="
},
"lodash.defaults": {
"version": "4.2.0",

View File

@ -46,6 +46,8 @@ data CourseForm = CourseForm
, cfAppRatingsVisible :: Bool
, cfCapacity :: Maybe Int
, cfSecret :: Maybe Text
, cfVisFrom :: Maybe UTCTime
, cfVisTo :: Maybe UTCTime
, cfRegFrom :: Maybe UTCTime
, cfRegTo :: Maybe UTCTime
, cfDeRegUntil :: Maybe UTCTime
@ -77,6 +79,8 @@ courseToForm cEnt@(Entity cid Course{..}) lecs lecInvites alloc = CourseForm
, cfAppText = courseApplicationsText
, cfAppFiles = courseApplicationsFiles
, cfAppRatingsVisible = courseApplicationsRatingsVisible
, cfVisFrom = courseVisibleFrom
, cfVisTo = courseVisibleTo
, cfRegFrom = courseRegisterFrom
, cfRegTo = courseRegisterTo
, cfDeRegUntil = courseDeregisterUntil
@ -286,6 +290,10 @@ makeCourseForm miButtonAction template = identifyForm FIDcourse . validateFormDB
& setTooltip MsgCourseCapacityTip) (cfCapacity <$> template)
<*> aopt (textField & cfStrip) (fslpI MsgCourseSecret (mr MsgCourseSecretFormat)
& setTooltip MsgCourseSecretTip) (cfSecret <$> template)
<*> aopt utcTimeField (fslpI MsgCourseVisibleFrom (mr MsgDate)
& setTooltip MsgCourseVisibleFromTip) (cfVisFrom <$> template)
<*> aopt utcTimeField (fslpI MsgCourseVisibleTo (mr MsgDate)
& setTooltip MsgCourseVisibleToTip) (cfVisTo <$> template)
<*> aopt utcTimeField (fslpI MsgRegisterFrom (mr MsgDate)
& setTooltip MsgCourseRegisterFromTip) (deepAlt (cfRegFrom <$> template) newRegFrom)
<*> aopt utcTimeField (fslpI MsgRegisterTo (mr MsgDate)
@ -456,6 +464,8 @@ courseEditHandler miButtonAction mbCourseForm = do
, courseApplicationsText = cfAppText
, courseApplicationsFiles = cfAppFiles
, courseApplicationsRatingsVisible = cfAppRatingsVisible
, courseVisibleFrom = cfVisFrom
, courseVisibleTo = cfVisTo
, courseRegisterFrom = cfRegFrom
, courseRegisterTo = cfRegTo
, courseDeregisterUntil = cfDeRegUntil
@ -504,6 +514,8 @@ courseEditHandler miButtonAction mbCourseForm = do
, courseApplicationsText = cfAppText
, courseApplicationsFiles = cfAppFiles
, courseApplicationsRatingsVisible = cfAppRatingsVisible
, courseVisibleFrom = cfVisFrom
, courseVisibleTo = cfVisTo
, courseRegisterFrom = cfRegFrom
, courseRegisterTo = cfRegTo
, courseDeregisterUntil = cfDeRegUntil

View File

@ -219,6 +219,7 @@ getCShowR tid ssh csh = do
hiddenEventNotes = all (\(_,CourseEvent{..}) -> is _Nothing courseEventNote) events
mayCreateNews <- hasWriteAccessTo $ CourseR tid ssh csh CNewsNewR
mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR
mayEditCourse <- hasWriteAccessTo $ CourseR tid ssh csh CEditR
siteLayout (toWgt $ courseName course) $ do
setTitleI $ prependCourseTitle tid ssh csh (""::Text)

View File

@ -116,6 +116,7 @@ $# #{summary}
<a href=#{link} target="_blank" rel="noopener" title="_{MsgCourseHomepageExternal}">
#{iconLink}
\ #{link}
$# $if NTop (Just 0) < NTop (courseCapacity course)
<dt .deflist__dt>_{MsgCourseParticipantsHeading}
<dd .deflist__dd>
@ -123,6 +124,20 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
_{MsgCourseParticipantsCountOf participants capacity}
$nothing
_{MsgCourseParticipantsCount participants}
$if mayEditCourse
<dt .deflist__dt>
$if isJust (courseVisibleTo course)
_{MsgCourseVisibility}
$else
_{MsgCourseVisibleFrom}
<dd .deflist__dd>
$maybe visFrom <- courseVisibleFrom course
<p>
^{formatTimeRangeW SelFormatDateTime visFrom (courseVisibleTo course)}
$nothing
_{MsgCourseInvisible}
$maybe (Allocation{allocationName, allocationRegisterByCourse}, url) <- mAllocation'
<dt .deflist__dt>_{MsgCourseAllocation}
<dd .deflist__dd>
@ -148,6 +163,7 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
$maybe dereg <- mDereg
<p .emph>
_{MsgCourseDeregisterUntil dereg}
$maybe aInst <- courseApplicationsInstructions course
<dt .deflist__dt>
$if courseApplicationsRequired course
@ -189,6 +205,7 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
$nothing
<i>
_{MsgNoSubmissionGroup}
$if registrationOpen || isJust registration
<dt .deflist__dt>
_{MsgCourseRegistration}
@ -210,6 +227,7 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
$if isJust registration
<p>
_{MsgCourseRegistrationDeleteToEdit}
<dt .deflist__dt>
_{MsgCourseMaterial}
<dd .deflist__dd>
@ -217,6 +235,7 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
_{MsgCourseMaterialFree}
$else
_{MsgCourseMaterialNotFree}
$if hasExams
<dt .deflist__dt>_{MsgCourseExams}
<dd .deflist__dd>