diff --git a/Foundation.hs b/Foundation.hs index 86f224c..93923f9 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -153,6 +153,8 @@ instance Yesod App where isAuthorized (ApiTxtScoreR _) _ = return Authorized + isAuthorized (ChallengeParamGraphDataR _ _) _ = return Authorized + -- Default to Authorized for now. isAuthorized _ _ = isTrustedAuthorized diff --git a/Handler/Graph.hs b/Handler/Graph.hs index 8409bed..037c773 100644 --- a/Handler/Graph.hs +++ b/Handler/Graph.hs @@ -10,6 +10,15 @@ import Database.Persist.Sql getChallengeGraphDataR :: Text -> Handler Value getChallengeGraphDataR challengeName = submissionsToJSON (\_ -> True) challengeName +getChallengeParamGraphDataR :: Text -> Text -> Handler Value +getChallengeParamGraphDataR challengeName paramName = do + return $ object [ "xs" .= object [ + "data1" .= ("x1" :: Text), + "data2" .= ("x2" :: Text)], + "columns" .= [ + ["x1"::Text, "10", "30", "40"], + ["x2", "10", "20", "50"] ]] + submissionsToJSON :: ((Entity Submission) -> Bool) -> Text -> Handler Value submissionsToJSON condition challengeName = do (Entity challengeId _) <- runDB $ getBy404 $ UniqueName challengeName diff --git a/config/routes b/config/routes index 69bb216..7963174 100644 --- a/config/routes +++ b/config/routes @@ -20,6 +20,7 @@ /challenge-how-to/#Text ChallengeHowToR GET /challenge-graph-data/#Text ChallengeGraphDataR GET /challenge-discussion/#Text ChallengeDiscussionR GET POST +/challenge-param-graph-data/#Text/#Text ChallengeParamGraphDataR GET /challenge-discussion-rss/#Text ChallengeDiscussionFeedR GET /trigger-remotely TriggerRemotelyR POST /trigger-locally TriggerLocallyR POST