refactor param graphs

This commit is contained in:
Filip Gralinski 2018-07-28 22:02:47 +02:00
parent 3388971ed6
commit abef15c905
5 changed files with 18 additions and 16 deletions

View File

@ -87,7 +87,6 @@ showChallengeWidget muserId challenge scheme challengeRepo test repo leaderboard
where leaderboardWithRanks = zip [1..] leaderboard where leaderboardWithRanks = zip [1..] leaderboard
maybeRepoLink = getRepoLink repo maybeRepoLink = getRepoLink repo
getRepoLink :: Repo -> Maybe Text getRepoLink :: Repo -> Maybe Text
getRepoLink repo getRepoLink repo
| sitePrefix `isPrefixOf` url = Just $ (browsableGitRepo bareRepoName) ++ "/" ++ (repoBranch repo) | sitePrefix `isPrefixOf` url = Just $ (browsableGitRepo bareRepoName) ++ "/" ++ (repoBranch repo)
@ -540,6 +539,9 @@ challengeAllSubmissionsWidget :: Maybe UserId
-> WidgetFor App () -> WidgetFor App ()
challengeAllSubmissionsWidget muserId challenge scheme challengeRepo submissions tests params = challengeAllSubmissionsWidget muserId challenge scheme challengeRepo submissions tests params =
$(widgetFile "challenge-all-submissions") $(widgetFile "challenge-all-submissions")
paramGraphsWidget :: Challenge -> [Entity Test] -> [Text] -> WidgetFor App ()
paramGraphsWidget challenge tests params = $(widgetFile "param-graphs")
where chartJSs = getCharsJss challenge selectedTests params where chartJSs = getCharsJss challenge selectedTests params
selectedTests = getMainTests tests selectedTests = getMainTests tests

View File

@ -11,16 +11,4 @@ $if not (null params)
<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">
$if not (null params) ^{paramGraphsWidget challenge tests params}
<h3>Graphs by parameters
$forall param <- params
<h4>
<tt>#{param}
$forall test <- selectedTests
<a name="link-chart-#{param}-#{toPathPiece $ entityKey test}">
<div id="chart-#{param}-#{toPathPiece $ entityKey test}">
[<a href="#link-chart-#{param}-#{toPathPiece $ entityKey test}">direct link</a>]
<script src="/static/js/d3.min.js" charset="utf-8"></script>
<script src="/static/js/c3.min.js"></script>

View File

@ -10,5 +10,3 @@
'pageLength': 50, 'pageLength': 50,
'order': [[1, 'desc']]}); 'order': [[1, 'desc']]});
} ); } );
^{chartJSs}

View File

@ -0,0 +1,13 @@
$if not (null params)
<h3>Graphs by parameters
$forall param <- params
<h4>
<tt>#{param}
$forall test <- selectedTests
<a name="link-chart-#{param}-#{toPathPiece $ entityKey test}">
<div id="chart-#{param}-#{toPathPiece $ entityKey test}">
[<a href="#link-chart-#{param}-#{toPathPiece $ entityKey test}">direct link</a>]
<script src="/static/js/d3.min.js" charset="utf-8"></script>
<script src="/static/js/c3.min.js"></script>

View File

@ -0,0 +1 @@
^{chartJSs}