forked from filipg/gonito
show param graphs for all non-dev tests
This commit is contained in:
parent
4883ffe946
commit
9d54deb68f
@ -316,9 +316,19 @@ thenCmp :: Ordering -> Ordering -> Ordering
|
|||||||
thenCmp EQ o2 = o2
|
thenCmp EQ o2 = o2
|
||||||
thenCmp o1 _ = o1
|
thenCmp o1 _ = o1
|
||||||
|
|
||||||
|
-- get the test with the highest priority
|
||||||
getMainTest :: [Entity Test] -> Entity Test
|
getMainTest :: [Entity Test] -> Entity Test
|
||||||
getMainTest tests = DL.maximumBy testComparator tests
|
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 Test -> Entity Test -> Ordering
|
||||||
testComparator (Entity _ a) (Entity _ b) =
|
testComparator (Entity _ a) (Entity _ b) =
|
||||||
((testName a) `compare` (testName b))
|
((testName a) `compare` (testName b))
|
||||||
|
@ -528,8 +528,12 @@ 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")
|
||||||
where chartJSs = mconcat $ map (getChartJs challenge mainTest) params
|
where chartJSs = getCharsJss challenge selectedTests params
|
||||||
mainTest = getMainTest tests
|
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
|
getChartJs :: Challenge
|
||||||
-> Entity Test
|
-> Entity Test
|
||||||
|
@ -16,7 +16,8 @@ $if not (null params)
|
|||||||
|
|
||||||
$forall param <- params
|
$forall param <- params
|
||||||
<h4>#{param}
|
<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/d3.min.js" charset="utf-8"></script>
|
||||||
<script src="/static/js/c3.min.js"></script>
|
<script src="/static/js/c3.min.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user