feat(allocations): link allocations from home

This commit is contained in:
Gregor Kleen 2019-08-19 15:55:33 +02:00
parent 1d1038a308
commit c759364ab1
5 changed files with 96 additions and 20 deletions

View File

@ -127,7 +127,7 @@ CourseShorthand: Kürzel
CourseShorthandUnique: Muss innerhalb Institut und Semester eindeutig sein
CourseSemester: Semester
CourseSchool: Institut
CourseSchoolShort: Fach
CourseSchoolShort: Institut
CourseSecretTip: Anmeldung zum Kurs erfordert Eingabe des Passworts, sofern gesetzt
CourseSecretFormat: beliebige Zeichenkette
CourseRegisterFromTip: Ohne Datum ist KEINE eigenständige Anmeldung von Studierenden möglich
@ -451,6 +451,7 @@ TokensLastReset: Tokens zuletzt invalidiert
TokensResetSuccess: Authorisierungs-Tokens invalidiert
HomeOpenCourses: Kurse mit offener Registrierung
HomeOpenAllocations: Offene Zentralanmeldungen
HomeUpcomingSheets: Anstehende Übungsblätter
HomeUpcomingExams: Bevorstehende Prüfungen
@ -1502,4 +1503,8 @@ ApplicationRatingPoints: Bewertung
ApplicationRatingPointsTip: Bewerber mit 5.0 werden garantiert nicht dem Kurs zugeteilt
ApplicationRatingComment: Kommentar
ApplicationRatingCommentVisibleTip: Feedback an den Bewerbers
ApplicationRatingCommentInvisibleTip: Dient zunächst nur als Notiz für Kursverwalter
ApplicationRatingCommentInvisibleTip: Dient zunächst nur als Notiz für Kursverwalter
AllocationSchoolShort: Institut
Allocation: Zentralanmeldung
AllocationRegisterTo: Anmeldungen bis

View File

@ -20,9 +20,65 @@ getHomeR = do
setTitleI MsgHomeHeading
fromMaybe mempty upcomingExamsWidget
maybe mempty homeUpcomingSheets muid
homeOpenAllocations
homeOpenCourses
homeOpenAllocations :: Widget
homeOpenAllocations = do
cTime <- liftIO getCurrentTime
let tableData :: E.SqlExpr (Entity Allocation)
-> E.SqlQuery (E.SqlExpr (Entity Allocation))
tableData allocation = do
E.where_ $ E.maybe E.false (\rf -> rf E.<=. E.val cTime) (allocation E.^. AllocationRegisterFrom)
E.&&. E.maybe E.true (\rt -> rt E.>=. E.val cTime) (allocation E.^. AllocationRegisterTo)
return allocation
colonnade :: Colonnade Sortable (DBRow (Entity Allocation)) (DBCell (HandlerT UniWorX IO) ())
colonnade = mconcat
[ -- dbRow
sortable (Just "term") (i18nCell MsgTerm)
$ \DBRow{ dbrOutput=Entity{entityVal = Allocation{..}} } ->
anchorCell (TermCourseListR allocationTerm) [whamlet|#{allocationTerm}|]
, sortable (Just "schoolshort") (i18nCell MsgAllocationSchoolShort)
$ \DBRow{ dbrOutput=(Entity _ Allocation{..}) } ->
anchorCell (TermSchoolCourseListR allocationTerm allocationSchool) [whamlet|_{unSchoolKey allocationSchool}|]
, sortable (Just "allocation") (i18nCell MsgAllocation) $ \DBRow{ dbrOutput=Entity{entityVal = Allocation{..}} } -> do
anchorCell (AllocationR allocationTerm allocationSchool allocationShorthand AShowR) allocationName
, sortable (Just "deadline") (i18nCell MsgAllocationRegisterTo) $ \DBRow{ dbrOutput=Entity{entityVal = Allocation{..}} } ->
cell $ traverse (formatTime SelFormatDateTime) allocationRegisterTo >>= maybe mempty toWidget
]
validator = def & defaultSorting [SortAscBy "deadline", SortAscBy "allocation"]
allocationTable <- liftHandlerT . runDB $ dbTableWidget' validator DBTable
{ dbtSQLQuery = tableData
, dbtRowKey = (E.^. AllocationId)
, dbtColonnade = colonnade
, dbtProj = return
, dbtSorting = Map.fromList
[ ( "term"
, SortColumn $ \allocation -> allocation E.^. AllocationTerm
)
, ( "schoolshort"
, SortColumn $ \allocation -> allocation E.^. AllocationSchool
)
, ( "allocation"
, SortColumn $ \allocation -> allocation E.^. AllocationShorthand
)
, ( "deadline"
, SortColumn $ \allocation -> allocation E.^. AllocationRegisterTo
)
]
, dbtFilter = mempty
, dbtFilterUI = mempty
, dbtStyle = def
, dbtParams = def
, dbtIdent = "open-allocations" :: Text
, dbtCsvEncode = noCsvEncode
, dbtCsvDecode = Nothing
}
$(widgetFile "home/openAllocations")
homeOpenCourses :: Widget
homeOpenCourses = do
cTime <- liftIO getCurrentTime
@ -34,6 +90,13 @@ homeOpenCourses = do
E.&&. ( E.isNothing (course E.^. CourseRegisterTo)
E.||. course E.^. CourseRegisterTo E.>=. E.val (Just cTime)
)
E.&&. E.not_ (E.exists . E.from $ \(allocation `E.InnerJoin` allocationCourse) -> do
E.on $ allocation E.^. AllocationId E.==. allocationCourse E.^. AllocationCourseAllocation
E.where_ $ allocationCourse E.^. AllocationCourseCourse E.==. course E.^. CourseId
E.where_ $ E.maybe E.true (\rf -> rf E.>. E.val cTime) (allocation E.^. AllocationRegisterFrom)
E.||. E.maybe E.false (\rt -> rt E.<. E.val cTime) (allocation E.^. AllocationRegisterTo)
E.where_ $ E.maybe E.true (\rf -> rf E.>. E.val cTime) (allocation E.^. AllocationRegisterByCourse)
)
return course
colonnade :: Colonnade Sortable (DBRow (Entity Course)) (DBCell (HandlerT UniWorX IO) ())
@ -53,7 +116,8 @@ homeOpenCourses = do
, sortable (Just "deadline") (i18nCell MsgRegisterTo) $ \DBRow{ dbrOutput=Entity{entityVal = course} } ->
cell $ traverse (formatTime SelFormatDateTime) (courseRegisterTo course) >>= maybe mempty toWidget
]
courseTable <- liftHandlerT . runDB $ dbTableWidget' def DBTable
validator = def & defaultSorting [SortAscBy "deadline", SortAscBy "course"]
courseTable <- liftHandlerT . runDB $ dbTableWidget' validator DBTable
{ dbtSQLQuery = tableData
, dbtRowKey = (E.^. CourseId)
, dbtColonnade = colonnade

View File

@ -0,0 +1,4 @@
$newline never
<section>
<h2>_{MsgHomeOpenAllocations}
^{allocationTable}

View File

@ -1,5 +1,15 @@
$newline never
<dl .deflist>
<dt .deflist__dt>19.08.2019
<dd .deflist__dd>
<ul>
<li>Bewerbungen für Zentralanmeldungen
<dt .deflist__dt>12.08.2019
<dd .deflist__dd>
<ul>
<li>Kurse zu Zentralanmeldungen eintragen
<dt .deflist__dt>23.07.2019
<dd .deflist__dd>
<ul>

View File

@ -12,8 +12,6 @@ $newline text
<p>
Veranstalter können eigene Veranstaltungen zu verschiedenen Zentralanmeldungen hinzufügen.
Dies findet man unter dem Menupunkt "Kurs editieren"
<p>
Die Zentralanmeldungen selbst sind momentan aber noch nicht sichtbar; dies folgt in Kürze.
<p>
Weitere Details finden sich weiter unter auf dieser Seite in einem
<a href="#allocations">
@ -32,16 +30,6 @@ $newline text
eigenem Abschnitt
\ detailliert.
<dt .deflist__dt>Benachrichtigungen
<dd .deflist__dd>
Benachrichtigungen werden momentan oft mit großer Verzögerung versandt.
Die Ursache ist derzeit noch unbekannt, da das Problem noch nicht genauer untersucht werden konnte.
$#
$# MOVE ITEM TO SECTION "VERANSTALTUNGEN", once it is implemented:
$#
<section>
<h2>Veranstaltungen
@ -365,16 +353,21 @@ $newline text
Veranstaltungen können einen beliebigen Namen tragen.
Die behelfsmäßigen Kürzel wie [SB], [ZP], usw sind nicht mehr notwendig!
<dt .deflist__dt> Kurseinstellung
<dt .deflist__dt> Kurseinstellungen
<dd .deflist__dd>
Die Kurseinstellungen werden ggf. von den notwendigen Einstellungen
der jeweiligen Zentralanmeldung überschrieben, d.h. Veranstalter
können hier keine Fehler mehr machen.
<p>
Die Kurseinstellungen werden ggf. von den notwendigen Einstellungen
der jeweiligen Zentralanmeldung überschrieben, d.h. Veranstalter
können hier keine Fehler mehr machen.
<p>
Insbesondere wird auch der eingestellte Anmeldungszeitraum ignoriert und
die direkte Anmeldung von Studierenden zum Kurs (auch durch die
Kursverwalter) unterbunden, bis die zentrale Platzvergabe erfolgt ist.
<dt .deflist__dt> Individuelle Bewerbungen
<dd .deflist__dd>
Studierende können nun pro Kurs eine individuelle Bewerbung abgeben,
welche nur den jeweiligen Kursverwaltern zugestelt wird.
welche nur den jeweiligen Kursverwaltern zugestellt wird.
<dt .deflist__dt> Feedback zu Bewerbungen