diff --git a/Foundation.hs b/Foundation.hs index 2138023..a720006 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -199,8 +199,7 @@ instance Yesod App where isAuthorized (ChallengeImageR _) _ = return Authorized - isAuthorized (ApiTxtScoreMainMetricR _) _ = return Authorized - isAuthorized (ApiTxtScoreWithMetricR _ _) _ = return Authorized + isAuthorized (ApiTxtScoreR _) _ = return Authorized isAuthorized (ChallengeParamGraphDataR _ _ _) _ = return Authorized isAuthorized (IndicatorGraphDataR _) _ = return Authorized diff --git a/Handler/Query.hs b/Handler/Query.hs index cb0dd45..2c72202 100644 --- a/Handler/Query.hs +++ b/Handler/Query.hs @@ -59,11 +59,12 @@ fetchSubmissionByOut (Entity _ out) = do fsi <- getFullInfo theSubmissionEnt return (fsi, outChecksum out) -getApiTxtScoreMainMetricR :: Text -> Handler Text -getApiTxtScoreMainMetricR sha1Prefix = getApiTxtScore Nothing sha1Prefix - -getApiTxtScoreWithMetricR :: Text -> Text -> Handler Text -getApiTxtScoreWithMetricR sha1Prefix metricName = getApiTxtScore (Just metricName) sha1Prefix +getApiTxtScoreR :: Text -> Handler Text +getApiTxtScoreR query = + if T.null post + then getApiTxtScore Nothing pre + else getApiTxtScore (Just $ T.tail post) pre + where (pre, post) = T.breakOn "-" query getApiTxtScore :: Maybe Text -> Text -> Handler Text getApiTxtScore mMetricName sha1Prefix = do diff --git a/config/routes b/config/routes index bdb98b7..f2ed0bc 100644 --- a/config/routes +++ b/config/routes @@ -34,8 +34,7 @@ /view-variant/#VariantId ViewVariantR GET -/api/txt/score/#Text ApiTxtScoreMainMetricR GET -/api/txt/score/#Text/#Text ApiTxtScoreWithMetricR GET +/api/txt/score/#Text ApiTxtScoreR GET /make-public/#SubmissionId MakePublicR GET /hide-submission/#SubmissionId HideSubmissionR GET