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 CourseShorthandUnique: Muss innerhalb Institut und Semester eindeutig sein
CourseSemester: Semester CourseSemester: Semester
CourseSchool: Institut CourseSchool: Institut
CourseSchoolShort: Fach CourseSchoolShort: Institut
CourseSecretTip: Anmeldung zum Kurs erfordert Eingabe des Passworts, sofern gesetzt CourseSecretTip: Anmeldung zum Kurs erfordert Eingabe des Passworts, sofern gesetzt
CourseSecretFormat: beliebige Zeichenkette CourseSecretFormat: beliebige Zeichenkette
CourseRegisterFromTip: Ohne Datum ist KEINE eigenständige Anmeldung von Studierenden möglich CourseRegisterFromTip: Ohne Datum ist KEINE eigenständige Anmeldung von Studierenden möglich
@ -451,6 +451,7 @@ TokensLastReset: Tokens zuletzt invalidiert
TokensResetSuccess: Authorisierungs-Tokens invalidiert TokensResetSuccess: Authorisierungs-Tokens invalidiert
HomeOpenCourses: Kurse mit offener Registrierung HomeOpenCourses: Kurse mit offener Registrierung
HomeOpenAllocations: Offene Zentralanmeldungen
HomeUpcomingSheets: Anstehende Übungsblätter HomeUpcomingSheets: Anstehende Übungsblätter
HomeUpcomingExams: Bevorstehende Prüfungen HomeUpcomingExams: Bevorstehende Prüfungen
@ -1502,4 +1503,8 @@ ApplicationRatingPoints: Bewertung
ApplicationRatingPointsTip: Bewerber mit 5.0 werden garantiert nicht dem Kurs zugeteilt ApplicationRatingPointsTip: Bewerber mit 5.0 werden garantiert nicht dem Kurs zugeteilt
ApplicationRatingComment: Kommentar ApplicationRatingComment: Kommentar
ApplicationRatingCommentVisibleTip: Feedback an den Bewerbers 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 setTitleI MsgHomeHeading
fromMaybe mempty upcomingExamsWidget fromMaybe mempty upcomingExamsWidget
maybe mempty homeUpcomingSheets muid maybe mempty homeUpcomingSheets muid
homeOpenAllocations
homeOpenCourses 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 :: Widget
homeOpenCourses = do homeOpenCourses = do
cTime <- liftIO getCurrentTime cTime <- liftIO getCurrentTime
@ -34,6 +90,13 @@ homeOpenCourses = do
E.&&. ( E.isNothing (course E.^. CourseRegisterTo) E.&&. ( E.isNothing (course E.^. CourseRegisterTo)
E.||. course E.^. CourseRegisterTo E.>=. E.val (Just cTime) 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 return course
colonnade :: Colonnade Sortable (DBRow (Entity Course)) (DBCell (HandlerT UniWorX IO) ()) 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} } -> , sortable (Just "deadline") (i18nCell MsgRegisterTo) $ \DBRow{ dbrOutput=Entity{entityVal = course} } ->
cell $ traverse (formatTime SelFormatDateTime) (courseRegisterTo course) >>= maybe mempty toWidget 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 { dbtSQLQuery = tableData
, dbtRowKey = (E.^. CourseId) , dbtRowKey = (E.^. CourseId)
, dbtColonnade = colonnade , dbtColonnade = colonnade

View File

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

View File

@ -1,5 +1,15 @@
$newline never $newline never
<dl .deflist> <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 <dt .deflist__dt>23.07.2019
<dd .deflist__dd> <dd .deflist__dd>
<ul> <ul>

View File

@ -12,8 +12,6 @@ $newline text
<p> <p>
Veranstalter können eigene Veranstaltungen zu verschiedenen Zentralanmeldungen hinzufügen. Veranstalter können eigene Veranstaltungen zu verschiedenen Zentralanmeldungen hinzufügen.
Dies findet man unter dem Menupunkt "Kurs editieren" Dies findet man unter dem Menupunkt "Kurs editieren"
<p>
Die Zentralanmeldungen selbst sind momentan aber noch nicht sichtbar; dies folgt in Kürze.
<p> <p>
Weitere Details finden sich weiter unter auf dieser Seite in einem Weitere Details finden sich weiter unter auf dieser Seite in einem
<a href="#allocations"> <a href="#allocations">
@ -32,16 +30,6 @@ $newline text
eigenem Abschnitt eigenem Abschnitt
\ detailliert. \ 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> <section>
<h2>Veranstaltungen <h2>Veranstaltungen
@ -365,16 +353,21 @@ $newline text
Veranstaltungen können einen beliebigen Namen tragen. Veranstaltungen können einen beliebigen Namen tragen.
Die behelfsmäßigen Kürzel wie [SB], [ZP], usw sind nicht mehr notwendig! Die behelfsmäßigen Kürzel wie [SB], [ZP], usw sind nicht mehr notwendig!
<dt .deflist__dt> Kurseinstellung <dt .deflist__dt> Kurseinstellungen
<dd .deflist__dd> <dd .deflist__dd>
Die Kurseinstellungen werden ggf. von den notwendigen Einstellungen <p>
der jeweiligen Zentralanmeldung überschrieben, d.h. Veranstalter Die Kurseinstellungen werden ggf. von den notwendigen Einstellungen
können hier keine Fehler mehr machen. 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 <dt .deflist__dt> Individuelle Bewerbungen
<dd .deflist__dd> <dd .deflist__dd>
Studierende können nun pro Kurs eine individuelle Bewerbung abgeben, 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 <dt .deflist__dt> Feedback zu Bewerbungen