From 8e4cb0917db1098f5b19be0dfad4c6fafb900c49 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Fri, 19 Feb 2021 15:03:13 +0100 Subject: [PATCH] fix: make sure unfortunate combination doesn't only produce 0-9 ranges for matrikelnummer --- src/Handler/Utils/Exam.hs | 3 +++ 1 file changed, 3 insertions(+) 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]