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