From 214ee17aaf5ffb5e207b46d663c1ad62675a31a3 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Mon, 23 Sep 2019 23:16:46 +0200 Subject: [PATCH] New presentation --- Foundation.hs | 1 + Handler/Presentation.hs | 30 ++- config/routes | 1 + gonito.cabal | 2 +- templates/default-layout.hamlet | 4 +- templates/presentation-psnc-2019.hamlet | 238 ++++++++++++++++++++++++ 6 files changed, 269 insertions(+), 7 deletions(-) create mode 100644 templates/presentation-psnc-2019.hamlet diff --git a/Foundation.hs b/Foundation.hs index c850fcf..ead3721 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -152,6 +152,7 @@ instance Yesod App where isAuthorized (ChallengeDiscussionFeedR _) _ = return Authorized isAuthorized Presentation4RealR _ = return Authorized + isAuthorized PresentationPSNC2019R _ = return Authorized isAuthorized GonitoInClassR _ = return Authorized isAuthorized (AvatarR _) _ = return Authorized diff --git a/Handler/Presentation.hs b/Handler/Presentation.hs index bdb8c80..c4c7825 100644 --- a/Handler/Presentation.hs +++ b/Handler/Presentation.hs @@ -2,6 +2,8 @@ module Handler.Presentation where import Import +import GEval.MetricsMeta + import Handler.ShowChallenge import Handler.Tables @@ -10,18 +12,17 @@ import qualified Yesod.Table as Table import Text.Hamlet (hamletFile) sampleChallengeName :: Text -sampleChallengeName = "petite-difference-challenge" +sampleChallengeName = "petite-difference-challenge2" sampleChallengeName' :: Text -sampleChallengeName' = "retroc" +sampleChallengeName' = "retroc2" retrocChallengeName :: Text -retrocChallengeName = "retroc" +retrocChallengeName = "retroc2" retroc2ChallengeName :: Text retroc2ChallengeName = "retroc2" - sampleUserIdent :: Text sampleUserIdent = "ptlen@ceti.pl" @@ -46,6 +47,27 @@ getPresentation4RealR = do presentationLayout $(widgetFile "presentation-4real") +getPresentationPSNC2019R :: Handler Html +getPresentationPSNC2019R = do + readme <- challengeReadme sampleChallengeName + + (Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName sampleChallengeName + + (Just (Entity sampleUserId _)) <- runDB $ getBy $ UniqueUser sampleUserIdent + let condition = (\(Entity _ submission) -> (submissionSubmitter submission == sampleUserId)) + (evaluationMaps', tests) <- runDB $ getChallengeSubmissionInfos condition challengeId + let evaluationMaps = take 10 evaluationMaps' + + sampleLeaderboard <- getSampleLeaderboard sampleChallengeName + sampleLeaderboard' <- getSampleLeaderboard sampleChallengeName' + + app <- getYesod + let scheme = appRepoScheme $ appSettings app + + challengeRepo <- runDB $ get404 $ challengePublicRepo challenge + + presentationLayout $(widgetFile "presentation-psnc-2019") + getPresentationDATeCH2017R = do readme <- challengeReadme retrocChallengeName retrocLeaderboard <- getSampleLeaderboard retrocChallengeName diff --git a/config/routes b/config/routes index 6f9bf51..7f9643d 100644 --- a/config/routes +++ b/config/routes @@ -72,4 +72,5 @@ /presentation/4real Presentation4RealR GET /presentation/datech-2017 PresentationDATeCH2017R GET +/presentation/psnc-2019 PresentationPSNC2019R GET /gonito-in-class GonitoInClassR GET diff --git a/gonito.cabal b/gonito.cabal index 27760be..626eb6e 100644 --- a/gonito.cabal +++ b/gonito.cabal @@ -127,7 +127,7 @@ library , filemanip , cryptohash , markdown - , geval >= 1.19.0.0 && < 1.22 + , geval >= 1.21.1.0 && < 1.22 , filepath , yesod-table , regex-tdfa diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index f39ad09..3cc9ba9 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -14,7 +14,7 @@