19 declare(strict_types=1);
51 $non_required_db = $this->db;
84 $this->quest_related_src_pool_def_register = [];
89 if (!array_key_exists($question_id, $this->quest_related_src_pool_def_register)) {
93 $this->quest_related_src_pool_def_register[$question_id]->addDefinition($definition);
102 if (isset($this->quest_related_src_pool_def_register[$questionId])) {
103 return $this->quest_related_src_pool_def_register[$questionId];
111 $this->src_pool_def_related_quest_register = [];
116 if (!isset($this->src_pool_def_related_quest_register[$definition_id])) {
120 $this->src_pool_def_related_quest_register[$definition_id]->addQuestion($random_set_question);
125 if (isset($this->src_pool_def_related_quest_register[$definition_id])) {
126 return $this->src_pool_def_related_quest_register[$definition_id];
135 $source_pool_definition = $this->source_pool_definition_list->getDefinition(
136 $random_question->getSourcePoolDefinitionId()
140 $random_question->getSourcePoolDefinitionId(),
144 if ($source_pool_definition && $random_question->getQuestionId()) {
146 $random_question->getQuestionId(),
147 $source_pool_definition
161 return $this->question_collection_provider->getSrcPoolDefListRelatedQuestCombinationCollection(
162 $this->source_pool_definition_list
175 $exclusiveQstCollection->addQuestion($question);
178 return $exclusiveQstCollection;
185 return $srcPoolDefRelatedQstCollection->getRelativeComplementCollection($exclusiveQstCollection);
189 int $this_definition_id,
190 int $that_definition_id
195 return $this_def_related_shared_qst_collection->getIntersectionCollection(
196 $that_def_related_shared_qst_collection
206 $intersectionQstCollectionsByDefId = [];
209 foreach ($sharedQuestionCollection as $sharedQuestion) {
211 foreach ($relatedSrcPoolDefList as $otherDefinition) {
212 if ($otherDefinition->getId() == $definition->
getId()) {
216 if (isset($intersectionQstCollectionsByDefId[$otherDefinition->getId()])) {
221 $definition->
getId(),
222 $otherDefinition->getId()
225 $intersectionQstCollectionsByDefId[$otherDefinition->getId()] = $intersectionQuestionCollection;
229 return $intersectionQstCollectionsByDefId;
241 foreach ($intersectionQstCollectionByDefIdMap as $otherDefinitionId => $intersectionCollection) {
245 $qstCollectionSubsetApplication->setQuestions($intersectionCollection->getQuestions());
246 $qstCollectionSubsetApplication->setApplicantId($otherDefinitionId);
248 $qstCollectionSubsetApplication->setRequiredAmount(
249 $this->source_pool_definition_list->getDefinition($otherDefinitionId)->getQuestionAmount()
252 $qstCollectionSubsetApplicationList->addCollectionSubsetApplication($qstCollectionSubsetApplication);
255 return $qstCollectionSubsetApplicationList;
269 foreach ($sharedQuestionCollection as $sharedQuestion) {
271 foreach ($relatedSrcPoolDefList as $otherDefinition) {
272 if ($otherDefinition->getId() == $definition->
getId()) {
276 if ($intersectionSharingDefinitionList->hasDefinition($otherDefinition->getId())) {
280 $intersectionSharingDefinitionList->addDefinition($otherDefinition);
284 return $intersectionSharingDefinitionList;
294 $qstRelatedSrcPoolDefList = $this->quest_related_src_pool_def_register[$question->
getQuestionId()];
295 return $qstRelatedSrcPoolDefList->getDefinitionCount() > 1;
324 $intersectionSubsetApplicationList->handleQuestionRequest($sharedQuestion);
327 return $intersectionSubsetApplicationList->getNonReservedQuestionAmount();
337 $missingExclsuiveQstCount = $exclusiveQstCollection->getMissingCount($definition->
getQuestionAmount());
338 return $missingExclsuiveQstCount;
376 $quantityCalculation->setIntersectionQuantitySharingDefinitionList(
380 return $quantityCalculation;
getIntersectionQuestionCollectionSubsetApplicationList(ilTestRandomQuestionSetSourcePoolDefinition $definition)
buildQuestionCollectionSubsetApplicationListInstance()
getSrcPoolDefRelatedQuestionCollection(int $definition_id)
getIntersectionQstCollectionByDefinitionMap(ilTestRandomQuestionSetSourcePoolDefinition $definition)
buildSourcePoolDefinitionListInstance()
__construct(private ilDBInterface $db, private ilTestRandomSourcePoolDefinitionQuestionCollectionProvider $question_collection_provider, private ilTestRandomQuestionSetSourcePoolDefinitionList $source_pool_definition_list)
resetQuestRelatedSrcPoolDefRegister()
resetSrcPoolDefRelatedQuestRegister()
getRequiredSharedQuestionAmount(ilTestRandomQuestionSetSourcePoolDefinition $definition)
getSharedQuestionCollection(int $definition_id)
getIntersectionSharingDefinitionList(ilTestRandomQuestionSetSourcePoolDefinition $definition)
getSrcPoolDefQuestionCombinationCollection()
requiresSharedQuestions(ilTestRandomQuestionSetSourcePoolDefinition $definition)
getAvailableSharedQuestionAmount(ilTestRandomQuestionSetSourcePoolDefinition $definition)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
isQuestionUsedByMultipleSrcPoolDefinitions(ilTestRandomQuestionSetQuestion $question)
getQuestRelatedSrcPoolDefinitionList($questionId)
buildQuestionCollectionSubsetApplicationInstance()
calculateQuantities(ilTestRandomQuestionSetSourcePoolDefinition $definition)
array $src_pool_def_related_quest_register
buildRandomQuestionCollectionInstance()
getExclusiveQuestionAmount(ilTestRandomQuestionSetSourcePoolDefinition $definition)
getSrcPoolDefRelatedQuestionAmount(ilTestRandomQuestionSetSourcePoolDefinition $definition)
array $quest_related_src_pool_def_register
registerSrcPoolDefRelatedQuest(int $definition_id, ilTestRandomQuestionSetQuestion $random_set_question)
getExclusiveQuestionCollection(int $definition_id)
getIntersectionQuestionCollection(int $this_definition_id, int $that_definition_id)
registerQuestRelatedSrcPoolDef(int $question_id, ilTestRandomQuestionSetSourcePoolDefinition $definition)