chore: matriculation numbers limited same length again

- this time as suffixes
- also start range description with full used length
  otherwise suffix-description is confusing
This commit is contained in:
Wolfgang Witt 2021-02-23 23:10:59 +01:00 committed by Wolfgang Witt
parent f0a79dff65
commit b974942f07

View File

@ -333,7 +333,8 @@ examAutoOccurrence (hash -> seed) rule config@ExamAutoOccurrenceConfig{..} occur
| (uid, (User{..}, Nothing)) <- Map.toList users
, matriculation' <- userMatrikelnummer ^.. _Just . filtered (not . null)
]
in matrUsers
takeEnd n chars = drop (length chars - n) chars
in Map.mapKeysWith Set.union (takeEnd . F.minimum . Set.map length $ Map.keysSet matrUsers) matrUsers
_ -> Map.singleton [] $ Map.keysSet users
occurrences' :: Map ExamOccurrenceId Natural
@ -599,10 +600,18 @@ examAutoOccurrence (hash -> seed) rule config@ExamAutoOccurrenceConfig{..} occur
&& (null t || Just (toNullable nextStart) > maybeEnd)
= go nextStart borderLength ((occurrenceId, mappingDescription) : acc) t
| borderLength < maxTagLength
= go (singleton $ head alphabet) (succ borderLength) [] result
= go restartStart restartBorderLength [] result
| otherwise
= []
where
restartBorderLength :: Int
restartBorderLength = succ borderLength
restartStart :: NonNull [CI Char]
restartStart = case rule of
ExamRoomMatriculation -> impureNonNull $ replicate restartBorderLength $ head alphabet
_rule -> singleton $ head alphabet
mappingDescription :: Set ExamOccurrenceMappingDescription
mappingDescription = Set.fromList $ case maybeEnd of
(Just end) -> ExamOccurrenceMappingRange (toNullable start) end : specialMapping