show param graphs for all non-dev tests

This commit is contained in:
Filip Gralinski 2018-07-28 21:22:52 +02:00
parent 4883ffe946
commit 9d54deb68f
3 changed files with 18 additions and 3 deletions

View File

@ -316,9 +316,19 @@ thenCmp :: Ordering -> Ordering -> Ordering
thenCmp EQ o2 = o2
thenCmp o1 _ = o1
-- get the test with the highest priority
getMainTest :: [Entity Test] -> Entity Test
getMainTest tests = DL.maximumBy testComparator tests
-- get all the non-dev tests starting with the one with the highest priorty
-- (or all the tests if there are no non-dev tests)
getMainTests :: [Entity Test] -> [Entity Test]
getMainTests tests = sortBy (flip testComparator) tests'
where tests' = if null tests''
then tests
else tests''
tests'' = filter (not . ("dev-" `isPrefixOf`) . testName . entityVal) tests
testComparator :: Entity Test -> Entity Test -> Ordering
testComparator (Entity _ a) (Entity _ b) =
((testName a) `compare` (testName b))

View File

@ -528,8 +528,12 @@ challengeAllSubmissionsWidget :: Maybe UserId
-> WidgetFor App ()
challengeAllSubmissionsWidget muserId challenge scheme challengeRepo submissions tests params =
$(widgetFile "challenge-all-submissions")
where chartJSs = mconcat $ map (getChartJs challenge mainTest) params
mainTest = getMainTest tests
where chartJSs = getCharsJss challenge selectedTests params
selectedTests = getMainTests tests
getCharsJss :: Challenge -> [Entity Test] -> [Text] -> JavascriptUrl (Route App)
getCharsJss challenge tests params =
mconcat $ [(getChartJs challenge test param) | test <- tests, param <- params]
getChartJs :: Challenge
-> Entity Test

View File

@ -16,7 +16,8 @@ $if not (null params)
$forall param <- params
<h4>#{param}
<div id="chart-#{param}-#{toPathPiece $ entityKey mainTest}">
$forall test <- selectedTests
<div id="chart-#{param}-#{toPathPiece $ entityKey test}">
<script src="/static/js/d3.min.js" charset="utf-8"></script>
<script src="/static/js/c3.min.js"></script>