forked from filipg/gonito
start working on C3
This commit is contained in:
parent
ae75c806c7
commit
276ca4d596
@ -153,6 +153,8 @@ instance Yesod App where
|
||||
|
||||
isAuthorized (ApiTxtScoreR _) _ = return Authorized
|
||||
|
||||
isAuthorized (ChallengeParamGraphDataR _ _) _ = return Authorized
|
||||
|
||||
-- Default to Authorized for now.
|
||||
isAuthorized _ _ = isTrustedAuthorized
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user