show only numerical params on graphs

This commit is contained in:
Filip Gralinski 2018-09-01 14:23:41 +02:00
parent 40016c36e5
commit bed12dee34

View File

@ -20,6 +20,8 @@ import Handler.Tables
import Handler.TagUtils import Handler.TagUtils
import Handler.MakePublic import Handler.MakePublic
import qualified Text.Read as TR
import GEval.Core import GEval.Core
import GEval.OptionsParser import GEval.OptionsParser
import GEval.ParseParams (parseParamsFromFilePath, OutputFileParsed(..)) import GEval.ParseParams (parseParamsFromFilePath, OutputFileParsed(..))
@ -48,7 +50,7 @@ getShowChallengeR name = do
mauth <- maybeAuth mauth <- maybeAuth
let muserId = (\(Entity uid _) -> uid) <$> mauth let muserId = (\(Entity uid _) -> uid) <$> mauth
let params = getAllParams entries let params = getNumericalParams entries
app <- getYesod app <- getYesod
let scheme = appRepoScheme $ appSettings app let scheme = appRepoScheme $ appSettings app
@ -534,7 +536,7 @@ getChallengeSubmissions condition name = do
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
let params = getAllParams evaluationMaps let params = getNumericalParams evaluationMaps
challengeLayout True challenge (challengeAllSubmissionsWidget muserId challengeLayout True challenge (challengeAllSubmissionsWidget muserId
challenge challenge
@ -544,6 +546,21 @@ getChallengeSubmissions condition name = do
tests tests
params) params)
getNumericalParams :: [TableEntry] -> [Text]
getNumericalParams entries = filter (isNumericalParam entries) $ getAllParams entries
isNumericalParam :: [TableEntry] -> Text -> Bool
isNumericalParam entries param =
all doesTextRepresentNumber
$ concat
$ map ((map parameterValue)
. (filter (\p -> parameterName p == param))
. (map entityVal)
. tableEntryParams) entries
doesTextRepresentNumber :: Text -> Bool
doesTextRepresentNumber t = isJust $ ((TR.readMaybe $ T.unpack t) :: Maybe Double)
getAllParams :: [TableEntry] -> [Text] getAllParams :: [TableEntry] -> [Text]
getAllParams entries = sort getAllParams entries = sort
$ nub $ nub