ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestRandomQuestionSetBuilderWithAmountPerTest.php
Go to the documentation of this file.
1 <?php
2 
26 {
30  public function checkBuildable(): bool
31  {
32  $questionStage = $this->getSrcPoolDefListRelatedQuestUniqueCollection($this->sourcePoolDefinitionList);
33 
34  if ($questionStage->isSmallerThan($this->questionSetConfig->getQuestionAmountPerTest())) {
35  return false;
36  }
37 
38  return true;
39  }
40 
44  public function performBuild(ilTestSession $testSession)
45  {
46  $questionStage = $this->getSrcPoolDefListRelatedQuestUniqueCollection($this->sourcePoolDefinitionList);
47 
48  $questionSet = $this->fetchQuestionsFromStageRandomly(
49  $questionStage,
50  $this->questionSetConfig->getQuestionAmountPerTest()
51  );
52 
53  $this->handleQuestionOrdering($questionSet);
54 
55  $this->storeQuestionSet($testSession, $questionSet);
56  }
57 }
getSrcPoolDefListRelatedQuestUniqueCollection(ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList)
handleQuestionOrdering(ilTestRandomQuestionSetQuestionCollection $questionSet)
fetchQuestionsFromStageRandomly(ilTestRandomQuestionSetQuestionCollection $questionStage, $requiredQuestionAmount)
storeQuestionSet(ilTestSession $testSession, $questionSet)