Merge branch 'master' into feat/exercises

This commit is contained in:
Gregor Kleen 2018-07-18 10:06:39 +02:00
commit 2be22a1ba8
4 changed files with 20 additions and 7 deletions

View File

@ -478,6 +478,8 @@ instance Yesod UniWorX where
menuTypes <- filterM (menuItemAccessCallback . menuItem) menu menuTypes <- filterM (menuItemAccessCallback . menuItem) menu
isAuth <- isJust <$> maybeAuthId
-- Lookup Favourites & Theme if possible -- TODO: cache this info in a cookie?! -- Lookup Favourites & Theme if possible -- TODO: cache this info in a cookie?!
(favourites',show -> currentTheme) <- do (favourites',show -> currentTheme) <- do
muid <- maybeAuthPair muid <- maybeAuthPair

View File

@ -68,6 +68,8 @@ instance Pretty x => Pretty (CI x) where
data Rating = Rating data Rating = Rating
{ ratingCourseName :: Text { ratingCourseName :: Text
, ratingSheetName :: Text , ratingSheetName :: Text
, ratingCorrectorName :: Maybe Text
, ratingSheetType :: SheetType
, ratingValues :: Rating' , ratingValues :: Rating'
} deriving (Read, Show, Eq, Generic, Typeable) } deriving (Read, Show, Eq, Generic, Typeable)
@ -89,15 +91,18 @@ instance Exception RatingException
getRating :: SubmissionId -> YesodDB UniWorX (Maybe Rating) getRating :: SubmissionId -> YesodDB UniWorX (Maybe Rating)
getRating submissionId = runMaybeT $ do getRating submissionId = runMaybeT $ do
let query = E.select . E.from $ \(submission `E.InnerJoin` sheet `E.InnerJoin` course) -> do let query = E.select . E.from $ \(corrector `E.RightOuterJoin` (submission `E.InnerJoin` sheet `E.InnerJoin` course)) -> do
E.on $ course E.^. CourseId E.==. sheet E.^. SheetCourse E.on $ course E.^. CourseId E.==. sheet E.^. SheetCourse
E.on $ sheet E.^. SheetId E.==. submission E.^. SubmissionSheet E.on $ sheet E.^. SheetId E.==. submission E.^. SubmissionSheet
E.on $ corrector E.?. UserId E.==. submission E.^. SubmissionRatingBy
E.where_ $ submission E.^. SubmissionId E.==. E.val submissionId E.where_ $ submission E.^. SubmissionId E.==. E.val submissionId
-- Yes, we can only pass a tuple through 'E.select' -- Yes, we can only pass a tuple through 'E.select'
return ( course E.^. CourseName return ( course E.^. CourseName
, sheet E.^. SheetName , sheet E.^. SheetName
, corrector E.?. UserDisplayName
, sheet E.^. SheetType
, submission E.^. SubmissionRatingPoints , submission E.^. SubmissionRatingPoints
, submission E.^. SubmissionRatingComment , submission E.^. SubmissionRatingComment
, submission E.^. SubmissionRatingTime , submission E.^. SubmissionRatingTime
@ -105,6 +110,8 @@ getRating submissionId = runMaybeT $ do
[ ( E.unValue -> ratingCourseName [ ( E.unValue -> ratingCourseName
, E.unValue -> ratingSheetName , E.unValue -> ratingSheetName
, E.unValue -> ratingCorrectorName
, E.unValue -> ratingSheetType
, E.unValue -> ratingPoints , E.unValue -> ratingPoints
, E.unValue -> ratingComment , E.unValue -> ratingComment
, E.unValue -> ratingTime , E.unValue -> ratingTime
@ -117,12 +124,14 @@ formatRating cID Rating{ ratingValues = Rating'{..}, ..} = let
doc = renderPretty 1 45 $ foldr (<$$>) mempty doc = renderPretty 1 45 $ foldr (<$$>) mempty
[ "= Bitte nur Bewertung und Kommentare ändern =" [ "= Bitte nur Bewertung und Kommentare ändern ="
, "=============================================" , "============================================="
, "========== Uni2work Bewertungsdatei ==========" , "========== Uni2work Bewertungsdatei ========="
, "======= diese Datei ist UTF8 encodiert ======" , "======= diese Datei ist UTF8 encodiert ======"
, "Informationen zum Übungsblatt:" , "Informationen zum Übungsblatt:"
, indent 2 $ foldr (<$$>) mempty , indent 2 . foldr (<$$>) mempty . catMaybes $
[ "Veranstaltung:" <+> pretty ratingCourseName [ Just $ "Veranstaltung:" <+> pretty ratingCourseName
, "Blatt:" <+> pretty ratingSheetName , Just $ "Blatt:" <+> pretty ratingSheetName
, ("Korrektor:" <+>) . pretty <$> ratingCorrectorName
, Just $ "Bewertung:" <+> pretty (display ratingSheetType)
] ]
, "Abgabe-Id:" <+> pretty (ciphertext cID) , "Abgabe-Id:" <+> pretty (ciphertext cID)
, "=============================================" , "============================================="

View File

@ -39,7 +39,7 @@ $newline never
} }
<body .no-js .#{currentTheme}> <body .no-js .#{currentTheme} :isAuth:.logged-in>
<!-- removes no-js class from body if client supports javascript --> <!-- removes no-js class from body if client supports javascript -->
<script> <script>
document.body.classList.remove('no-js'); document.body.classList.remove('no-js');

View File

@ -9,10 +9,12 @@
<li> Studiengänge von Benutzern werden noch ignoriert <li> Studiengänge von Benutzern werden noch ignoriert
<li> Übungsgruppen <li> Übungsgruppen
<li> Klausuren <li> Klausuren
<li> Zentralanmeldungen
<li> <li>
<h4> <h4>
neue geplante Features: neue geplante Features:
<ul> <ul>
<li> Studenplan/Kalender <li> Stundenplan/Kalender
<li> Vollständige Vorlesungshomepages <li> Vollständige Vorlesungshomepages
<li> Vollständige Internationalisierung deutsch/englisch/... <li> Vollständige Internationalisierung deutsch/englisch/...