fix: make sure it compiles again + add 2-letter name
This commit is contained in:
parent
a66c61cecc
commit
d60f93561f
@ -535,7 +535,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
postprocess result = seq resultAscList (resultAscList, resultUsers)
|
postprocess result = seq resultAscList (resultAscList, resultUsers)
|
||||||
where
|
where
|
||||||
maxTagLength :: Int
|
maxTagLength :: Int
|
||||||
maxTagLength = maximum $ map (length . snd) result
|
maxTagLength = maybe 0 maximum $ fromNullable $ map (length . snd) result
|
||||||
|
|
||||||
rangeAlphabet :: [CI Char]
|
rangeAlphabet :: [CI Char]
|
||||||
rangeAlphabet = case rule of
|
rangeAlphabet = case rule of
|
||||||
@ -565,7 +565,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
| length start < maxTagLength
|
| length start < maxTagLength
|
||||||
= go (impureNonNull $ replicate (succ $ length start) $ head alphabet) [] result
|
= go (impureNonNull $ replicate (succ $ length start) $ head alphabet) [] result
|
||||||
| otherwise
|
| otherwise
|
||||||
= Map.empty
|
= []
|
||||||
where
|
where
|
||||||
mappingDescription :: ExamOccurrenceMappingDescription
|
mappingDescription :: ExamOccurrenceMappingDescription
|
||||||
mappingDescription = ExamOccurrenceMappingRange (toNullable start) end
|
mappingDescription = ExamOccurrenceMappingRange (toNullable start) end
|
||||||
@ -592,10 +592,10 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
increase :: [CI Char] -> [CI Char]
|
increase :: [CI Char] -> [CI Char]
|
||||||
increase [] = []
|
increase [] = []
|
||||||
increase (c:cs)
|
increase (c:cs)
|
||||||
|
| c < head alphabet
|
||||||
|
= head alphabet : cs
|
||||||
| nextChar == head alphabet
|
| nextChar == head alphabet
|
||||||
= nextChar : increase cs
|
= nextChar : increase cs
|
||||||
| nextChar == paddingChar
|
|
||||||
= head alphabet : cs
|
|
||||||
| otherwise
|
| otherwise
|
||||||
= nextChar : cs
|
= nextChar : cs
|
||||||
where
|
where
|
||||||
@ -603,9 +603,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
nextChar
|
nextChar
|
||||||
| c `elem` alphabet
|
| c `elem` alphabet
|
||||||
= dropWhile (/= c) alphabetCycle List.!! 1
|
= dropWhile (/= c) alphabetCycle List.!! 1
|
||||||
| c < head alphabet -- includes padding char
|
| otherwise -- includes padding char
|
||||||
= head alphabet
|
|
||||||
| c > last alphabet -- basically all non-ascii printable characters
|
|
||||||
= head alphabet
|
= head alphabet
|
||||||
-- TODO what if the border is between to non-ascii characters?
|
-- TODO what if the border is between to non-ascii characters?
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ spec = do
|
|||||||
, "Martin", "Jackson", "Thompson", "White"
|
, "Martin", "Jackson", "Thompson", "White"
|
||||||
, "Lopez", "Lee", "Gonzalez", "Harris"
|
, "Lopez", "Lee", "Gonzalez", "Harris"
|
||||||
, "Clark", "Lewis", "Robinson", "Walker"
|
, "Clark", "Lewis", "Robinson", "Walker"
|
||||||
, "Perez", "Hall", "Young", "zu Allen"
|
, "Perez", "Hall", "Young", "zu Allen", "Fu"
|
||||||
, "Únîcòdé", "Ähm-Ümlaüte", "von Leerzeichen"
|
, "Únîcòdé", "Ähm-Ümlaüte", "von Leerzeichen"
|
||||||
]
|
]
|
||||||
occurrenceMap :: Map UserId (Maybe ExamOccurrenceId) -> Map ExamOccurrenceId [UserId]
|
occurrenceMap :: Map UserId (Maybe ExamOccurrenceId) -> Map ExamOccurrenceId [UserId]
|
||||||
|
|||||||
Reference in New Issue
Block a user