From dddd262b6b37ba7c259643ad235b08dbade8b04c Mon Sep 17 00:00:00 2001 From: SJost Date: Tue, 3 Jul 2018 14:05:21 +0200 Subject: [PATCH] Korrektur Button is hidden if there is no such correction --- config/keter_uni2work.yml | 10 ++++------ src/Foundation.hs | 9 +++++++-- templates/versionHistory.hamlet | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config/keter_uni2work.yml b/config/keter_uni2work.yml index ca1c4cdbb..e9ed09568 100644 --- a/config/keter_uni2work.yml +++ b/config/keter_uni2work.yml @@ -26,11 +26,6 @@ stanzas: - LDAPBN - DETAILED_LOGGING - LOG_ALL - - PGUSER - - PGPASS - - PGHOST - - PGPORT - - PGDATABASE # Use the following to automatically copy your bundle upon creation via `yesod # keter`. Uses `scp` internally, so you can set it to a remote destination @@ -42,4 +37,7 @@ copy-to-args: [] # If you would like to have Keter automatically create a PostgreSQL database # and set appropriate environment variables for it to be discovered, uncomment # the following line. -plugins: {} +plugins: + postgres: + - server: uniworxdb + port: 5432 diff --git a/src/Foundation.hs b/src/Foundation.hs index ef5adb693..51303d52b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -294,7 +294,7 @@ knownTags = Map.fromList -- should not throw exceptions, i.e. no getBy404 or req ,("time", APDB $ \route _ -> case route of CSheetR tid csh shn subRoute -> maybeT (unauthorizedI MsgUnauthorizedSheetTime) $ do Entity cid _ <- MaybeT . getBy $ CourseTermShort tid csh - Entity sid Sheet{..} <- MaybeT . getBy $ CourseSheet cid shn + Entity _sid Sheet{..} <- MaybeT . getBy $ CourseSheet cid shn cTime <- liftIO getCurrentTime let started = sheetActiveFrom <= cTime || NTop sheetVisibleFrom <= (NTop $ Just cTime) case subRoute of @@ -771,7 +771,12 @@ pageActions (CSubmissionR tid csh shn cid SubShowR) = { menuItemLabel = "Korrektur" , menuItemIcon = Nothing , menuItemRoute = CSubmissionR tid csh shn cid CorrectionR - , menuItemAccessCallback' = return True + , menuItemAccessCallback' = do + smid <- decrypt cid + sm <- runDB $ get smid + case sm of + (Just (Submission { submissionRatingTime=Just _})) -> return True + _ -> return False } ] pageActions TermShowR = diff --git a/templates/versionHistory.hamlet b/templates/versionHistory.hamlet index 4f6c0da5f..7002ee22a 100644 --- a/templates/versionHistory.hamlet +++ b/templates/versionHistory.hamlet @@ -28,7 +28,7 @@

- Ismpressum + Impressum