param graphs are shown for the challenge main page as well

This commit is contained in:
Filip Gralinski 2018-07-28 22:10:55 +02:00
parent abef15c905
commit ff8d8d8e7a
2 changed files with 27 additions and 7 deletions

View File

@ -44,10 +44,12 @@ getShowChallengeR :: Text -> Handler Html
getShowChallengeR name = do getShowChallengeR name = do
(Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name (Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name
Just repo <- runDB $ get $ challengePublicRepo challenge Just repo <- runDB $ get $ challengePublicRepo challenge
(mainTest, leaderboard, _) <- getLeaderboardEntries challengeId (mainTest, leaderboard, (entries, tests)) <- getLeaderboardEntries challengeId
mauth <- maybeAuth mauth <- maybeAuth
let muserId = (\(Entity uid _) -> uid) <$> mauth let muserId = (\(Entity uid _) -> uid) <$> mauth
let params = getAllParams entries
app <- getYesod app <- getYesod
let scheme = appRepoScheme $ appSettings app let scheme = appRepoScheme $ appSettings app
@ -58,7 +60,9 @@ getShowChallengeR name = do
challengeRepo challengeRepo
mainTest mainTest
repo repo
leaderboard) leaderboard
params
tests)
getChallengeReadmeR :: Text -> Handler Html getChallengeReadmeR :: Text -> Handler Html
getChallengeReadmeR name = do getChallengeReadmeR name = do
@ -82,8 +86,19 @@ showChallengeWidget :: Maybe UserId
-> Test -> Test
-> Repo -> Repo
-> [LeaderboardEntry] -> [LeaderboardEntry]
-> [Text]
-> [Entity Test]
-> WidgetFor App () -> WidgetFor App ()
showChallengeWidget muserId challenge scheme challengeRepo test repo leaderboard = $(widgetFile "show-challenge") showChallengeWidget muserId
challenge
scheme
challengeRepo
test
repo
leaderboard
params
tests
= $(widgetFile "show-challenge")
where leaderboardWithRanks = zip [1..] leaderboard where leaderboardWithRanks = zip [1..] leaderboard
maybeRepoLink = getRepoLink repo maybeRepoLink = getRepoLink repo
@ -516,10 +531,7 @@ getChallengeSubmissions condition name = do
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
let params = sort let params = getAllParams evaluationMaps
$ nub
$ concat
$ map (\entry -> map (parameterName . entityVal) (tableEntryParams entry)) evaluationMaps
challengeLayout True challenge (challengeAllSubmissionsWidget muserId challengeLayout True challenge (challengeAllSubmissionsWidget muserId
challenge challenge
@ -529,6 +541,12 @@ getChallengeSubmissions condition name = do
tests tests
params) params)
getAllParams :: [TableEntry] -> [Text]
getAllParams entries = sort
$ nub
$ concat
$ map (\entry -> map (parameterName . entityVal) (tableEntryParams entry)) entries
challengeAllSubmissionsWidget :: Maybe UserId challengeAllSubmissionsWidget :: Maybe UserId
-> Challenge -> Challenge
-> RepoScheme -> RepoScheme

View File

@ -11,3 +11,5 @@ $nothing
<script src="/static/js/sigma.min.js"> <script src="/static/js/sigma.min.js">
<script src="/static/js/sigma.parsers.json.min.js"> <script src="/static/js/sigma.parsers.json.min.js">
^{paramGraphsWidget challenge tests params}