forked from filipg/gonito
refactor getMainTest
This commit is contained in:
parent
e263a37eca
commit
c60e786025
@ -317,9 +317,14 @@ thenCmp EQ o2 = o2
|
|||||||
thenCmp o1 _ = o1
|
thenCmp o1 _ = o1
|
||||||
|
|
||||||
getMainTest :: [Entity Test] -> Entity Test
|
getMainTest :: [Entity Test] -> Entity Test
|
||||||
getMainTest tests = DL.maximumBy (\(Entity _ a) (Entity _ b) -> ( ((testName a) `compare` (testName b))
|
getMainTest tests = DL.maximumBy testComparator tests
|
||||||
|
|
||||||
|
testComparator :: Entity Test -> Entity Test -> Ordering
|
||||||
|
testComparator (Entity _ a) (Entity _ b) =
|
||||||
|
((testName a) `compare` (testName b))
|
||||||
`thenCmp`
|
`thenCmp`
|
||||||
((fromMaybe 9999 $ testPriority b) `compare` (fromMaybe 9999 $ testPriority a)) ) ) tests
|
((fromMaybe unknownPriority $ testPriority b) `compare` (fromMaybe unknownPriority $ testPriority a))
|
||||||
|
where unknownPriority = 9999
|
||||||
|
|
||||||
formatFullScore :: Maybe Evaluation -> Text
|
formatFullScore :: Maybe Evaluation -> Text
|
||||||
formatFullScore (Just evaluation) = fromMaybe "???" (T.pack <$> show <$> evaluationScore evaluation)
|
formatFullScore (Just evaluation) = fromMaybe "???" (T.pack <$> show <$> evaluationScore evaluation)
|
||||||
|
Loading…
Reference in New Issue
Block a user