forked from filipg/gonito
Add more utils for presentations
This commit is contained in:
parent
e27766b0a6
commit
9fe07335cd
@ -78,10 +78,15 @@ getPresentationDATeCH2017R = do
|
|||||||
|
|
||||||
|
|
||||||
getSampleLeaderboard :: Text -> HandlerFor App (WidgetFor App ())
|
getSampleLeaderboard :: Text -> HandlerFor App (WidgetFor App ())
|
||||||
getSampleLeaderboard name = do
|
getSampleLeaderboard name = getSampleLeaderboardGeneralized name 1 BySubmitter leaderboardTable
|
||||||
|
|
||||||
|
getSampleAltLeaderboard :: Text -> HandlerFor App (WidgetFor App ())
|
||||||
|
getSampleAltLeaderboard name = getSampleLeaderboardGeneralized name 2 ByTag altLeaderboardTable
|
||||||
|
|
||||||
|
getSampleLeaderboardGeneralized name maxPriority method table = do
|
||||||
(Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name
|
(Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name
|
||||||
|
|
||||||
(leaderboard, (_, tests)) <- getLeaderboardEntries 1 BySubmitter challengeId
|
(leaderboard, (_, tests)) <- getLeaderboardEntries maxPriority method challengeId
|
||||||
let leaderboardWithRanks = zip [1..] (take 10 leaderboard)
|
let leaderboardWithRanks = zip [1..] (take 10 leaderboard)
|
||||||
|
|
||||||
app <- getYesod
|
app <- getYesod
|
||||||
@ -89,11 +94,13 @@ getSampleLeaderboard name = do
|
|||||||
|
|
||||||
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
|
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
|
||||||
|
|
||||||
return $ Table.buildBootstrap (leaderboardTable Nothing
|
return $ Table.buildBootstrap (table Nothing
|
||||||
(challengeName challenge)
|
(challengeName challenge)
|
||||||
scheme challengeRepo tests)
|
scheme challengeRepo tests)
|
||||||
leaderboardWithRanks
|
leaderboardWithRanks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
presentationLayout widget = do
|
presentationLayout widget = do
|
||||||
pc <- widgetToPageContent widget
|
pc <- widgetToPageContent widget
|
||||||
withUrlRenderer $(hamletFile "templates/presentation-layout.hamlet")
|
withUrlRenderer $(hamletFile "templates/presentation-layout.hamlet")
|
||||||
|
Loading…
Reference in New Issue
Block a user