diff --git a/ChangeLog.md b/ChangeLog.md index 09b99076d..fbe1b5009 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,6 @@ + * Version 10.07.2018 + Bugfixes, wählbares Format für Datum + * Version 04.07.2018 Hinweis eingefügt, dass alle Daten des Systems spätestens im Dezember 2018 diff --git a/src/Foundation.hs b/src/Foundation.hs index 0a6a3b50d..51062691d 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -187,7 +187,7 @@ getTimeLocale' = $(timeLocaleMap [("de", "de_DE.utf8")]) appTZ :: TZ appTZ = $(includeSystemTZ "Europe/Berlin") - + -- Access Control data AccessPredicate = APPure (Route UniWorX -> Bool -> Reader MsgRenderer AuthResult) @@ -478,6 +478,8 @@ instance Yesod UniWorX where menuTypes <- filterM (menuItemAccessCallback . menuItem) menu + isAuth <- isJust <$> maybeAuthId + -- Lookup Favourites & Theme if possible -- TODO: cache this info in a cookie?! (favourites',show -> currentTheme) <- do muid <- maybeAuthPair @@ -604,7 +606,7 @@ instance YesodBreadcrumbs UniWorX where breadcrumb UsersR = return ("Benutzer", Just HomeR) breadcrumb AdminTestR = return ("Test" , Just HomeR) breadcrumb (AdminUserR _) = return ("Users" , Just UsersR) - breadcrumb VersionR = return ("Info" , Just HomeR) + breadcrumb VersionR = return ("Impressum" , Just HomeR) breadcrumb ProfileR = return ("Profile" , Just HomeR) breadcrumb ProfileDataR = return ("Data" , Just ProfileR) diff --git a/src/Handler/Users.hs b/src/Handler/Users.hs index 9d3965c57..47a27cbaa 100644 --- a/src/Handler/Users.hs +++ b/src/Handler/Users.hs @@ -34,6 +34,12 @@ getUsersR = do , sortable (Just "display-name") (i18nCell MsgName) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM (AdminUserR <$> encrypt uid) (toWidget . display $ userDisplayName) + , sortable (Just "matriculation") (i18nCell MsgMatrikelNr) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM + (AdminUserR <$> encrypt uid) + (toWidget . display $ userMatrikelnummer) +-- , sortable (Just "last-name") (i18nCell MsgName) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM +-- (AdminUserR <$> encrypt uid) +-- (toWidget . display $ last $ impureNonNull $ words $ userDisplayName) , sortable Nothing (i18nCell MsgAdminFor) $ \DBRow{ dbrOutput = Entity uid _ } -> mempty { dbCellContents = do schools <- E.select . E.from $ \(school `E.InnerJoin` userAdmin) -> do @@ -78,6 +84,12 @@ getUsersR = do [ ( "display-name" , SortColumn $ \user -> user E.^. UserDisplayName ) + , ( "matriculation" + , SortColumn $ \user -> user E.^. UserMatrikelnummer + ) +-- , ( "last-name" +-- , SortColumn $ \user -> (last . impureNonNull . words) <$> (user E.^. UserDisplayName) +-- ) ] , dbtFilter = mempty , dbtStyle = def diff --git a/src/Handler/Utils/Rating.hs b/src/Handler/Utils/Rating.hs index dfe7845c3..2bb15c23f 100644 --- a/src/Handler/Utils/Rating.hs +++ b/src/Handler/Utils/Rating.hs @@ -68,6 +68,8 @@ instance Pretty x => Pretty (CI x) where data Rating = Rating { ratingCourseName :: Text , ratingSheetName :: Text + , ratingCorrectorName :: Maybe Text + , ratingSheetType :: SheetType , ratingValues :: Rating' } deriving (Read, Show, Eq, Generic, Typeable) @@ -89,15 +91,18 @@ instance Exception RatingException getRating :: SubmissionId -> YesodDB UniWorX (Maybe Rating) 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 $ 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 -- Yes, we can only pass a tuple through 'E.select' return ( course E.^. CourseName , sheet E.^. SheetName + , corrector E.?. UserDisplayName + , sheet E.^. SheetType , submission E.^. SubmissionRatingPoints , submission E.^. SubmissionRatingComment , submission E.^. SubmissionRatingTime @@ -105,6 +110,8 @@ getRating submissionId = runMaybeT $ do [ ( E.unValue -> ratingCourseName , E.unValue -> ratingSheetName + , E.unValue -> ratingCorrectorName + , E.unValue -> ratingSheetType , E.unValue -> ratingPoints , E.unValue -> ratingComment , E.unValue -> ratingTime @@ -117,12 +124,14 @@ formatRating cID Rating{ ratingValues = Rating'{..}, ..} = let doc = renderPretty 1 45 $ foldr (<$$>) mempty [ "= Bitte nur Bewertung und Kommentare ändern =" , "=============================================" - , "========== Uni2work Bewertungsdatei ==========" + , "========== Uni2work Bewertungsdatei =========" , "======= diese Datei ist UTF8 encodiert ======" , "Informationen zum Übungsblatt:" - , indent 2 $ foldr (<$$>) mempty - [ "Veranstaltung:" <+> pretty ratingCourseName - , "Blatt:" <+> pretty ratingSheetName + , indent 2 . foldr (<$$>) mempty . catMaybes $ + [ Just $ "Veranstaltung:" <+> pretty ratingCourseName + , Just $ "Blatt:" <+> pretty ratingSheetName + , ("Korrektor:" <+>) . pretty <$> ratingCorrectorName + , Just $ "Bewertung:" <+> pretty (display ratingSheetType) ] , "Abgabe-Id:" <+> pretty (ciphertext cID) , "=============================================" diff --git a/templates/default-layout-wrapper.hamlet b/templates/default-layout-wrapper.hamlet index 4eb2fd2c0..d963d1431 100644 --- a/templates/default-layout-wrapper.hamlet +++ b/templates/default-layout-wrapper.hamlet @@ -39,7 +39,7 @@ $newline never } - +