fix: make sure unfortunate combination doesn't only produce 0-9 ranges for matrikelnummer

This commit is contained in:
Wolfgang Witt 2021-02-19 15:03:13 +01:00 committed by Wolfgang Witt
parent 525e24b56d
commit 8e4cb0917d

View File

@ -567,6 +567,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
go start borderLength acc ((_occurrenceId, []):t) = go start borderLength acc t
go start borderLength acc ((occurrenceId, userTags):t)
| matchMappingDescription mappingDescription userTags
&& (null t || Just (toNullable nextStart) > maybeEnd)
= go nextStart borderLength ((occurrenceId, mappingDescription) : acc) t
| borderLength < maxTagLength
= go (singleton $ head alphabet) (succ borderLength) [] result
@ -586,6 +587,8 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
-- | pre/suffix of largest user tag
maybeEnd :: Maybe [CI Char]
maybeEnd = case t of
-- TODO account for special tags
-- e.g. don't stop at T if Ù is in the special prefix set
[] -> Just $ replicate borderLength $ last alphabet
_nonEmpty -> transformTag borderLength . maximum <$> fromNullable alphabetTags
nextStart :: NonNull [CI Char]