refactor: hlint
This commit is contained in:
parent
3a92fd7ed0
commit
b7d7252649
@ -328,7 +328,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
||||
fillUnrestricted :: [ExamOccurrenceId] -> ([(UserId, Maybe ExamOccurrenceId)], [UserId]) -> [(UserId, Maybe ExamOccurrenceId)]
|
||||
fillUnrestricted _unrestrictedRooms (acc, []) = acc
|
||||
fillUnrestricted [] _ = error "fillUnrestricted should only be called with an infinite list"
|
||||
fillUnrestricted (nextRoom:followingRooms) (acc, (nextUser:remainingUsers))
|
||||
fillUnrestricted (nextRoom:followingRooms) (acc, nextUser:remainingUsers)
|
||||
= fillUnrestricted followingRooms ((nextUser, Just nextRoom) : acc, remainingUsers)
|
||||
_ -> bimap (ExamOccurrenceMapping rule) (Map.unionWith (<|>) (view _2 <$> users)) . postprocess <$> bestOption
|
||||
where
|
||||
@ -421,7 +421,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
||||
where
|
||||
longestLine :: Natural
|
||||
-- ^ For scaling costs
|
||||
longestLine = maximum $ impureNonNull $ catMaybes $ (view $ _2 . _examOccurrenceCapacityIso) <$> lineLengths
|
||||
longestLine = maximum $ impureNonNull $ catMaybes $ view (_2 . _examOccurrenceCapacityIso) <$> lineLengths
|
||||
-- only evaluated for restricted lines, so impureNonNull is fine here
|
||||
|
||||
wordMap :: Map wordId Natural
|
||||
@ -527,7 +527,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
||||
| otherwise = Finite (max 1 . abs $ ((fromIntegral w % fromIntegral lineWidth) - optimumRatio') * fromIntegral longestLine) ^ 2
|
||||
where
|
||||
optimumRatio = ((%) `on` fromIntegral . max 1 . sum) (map (view _2) wordLengths) restrictedLengths
|
||||
restrictedLengths = catMaybes $ (view $ _2 . _examOccurrenceCapacityIso) <$> lineLengths
|
||||
restrictedLengths = catMaybes $ view (_2 . _examOccurrenceCapacityIso) <$> lineLengths
|
||||
-- ^ might be empty, so we need max 1 after sum!
|
||||
optimumRatio' = maybe 0 (fromIntegral . lineNudge) l * eaocNudgeSize + optimumRatio
|
||||
|
||||
@ -536,7 +536,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
||||
where
|
||||
longestLine :: Natural
|
||||
longestLine = maybe 1 maximum $ fromNullable $ catMaybes
|
||||
$ (view $ _2 . _examOccurrenceCapacityIso) <$> occurrences''
|
||||
$ view (_2 . _examOccurrenceCapacityIso) <$> occurrences''
|
||||
|
||||
|
||||
lcp :: Eq a => [a] -> [a] -> [a]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user