diff --git a/src/Handler/Utils/Exam.hs b/src/Handler/Utils/Exam.hs index b3632453a..6dc50e878 100644 --- a/src/Handler/Utils/Exam.hs +++ b/src/Handler/Utils/Exam.hs @@ -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]