19declare(strict_types=1);
49 $this->question_properties_repo->getForQuestionIds($question_ids),
50 $this->getSequencePropertiesForQuestionIds($question_ids)
70 $query = $this->db->query(
71 'SELECT question_fi, COUNT(*) as nr_of_answers, SUM(points) as achieved_points'
72 .
' FROM ' . self::RESULTS_TABLE
73 .
' INNER JOIN ' . self::ATTEMPTS_TABLE .
' ON active_fi = active_id'
74 .
' WHERE answered = 1 AND ' . $this->db->in(
76 array_keys($general_question_properties),
79 ) .
' GROUP BY question_fi'
84 static function (array
$c, \stdClass $v): array {
85 if (
$c[$v->question_fi] ===
null) {
89 $c[$v->question_fi] =
$c[$v->question_fi]->withAggregatedResults(
93 $c[$v->question_fi]->getGeneralQuestionProperties()->getAvailablePoints(),
99 $general_question_properties
105 $query = $this->db->query(
106 'SELECT COUNT(*) as nr_of_answers'
107 .
' FROM ' . self::RESULTS_TABLE
108 .
' INNER JOIN ' . self::ATTEMPTS_TABLE .
' ON active_fi = active_id'
109 .
' WHERE answered = 1 AND question_fi=' . $question_id
112 return $this->db->fetchObject($query)->nr_of_answers > 0;
117 return $this->question_properties_repo->originalQuestionExists($question_id);
126 $query = $this->db->query(
127 'SELECT test_fi, question_fi, sequence FROM ' . self::LINKING_TABLE_TEST_FIXED
133 static function (array
$c, \stdClass $v): array {
141 array_fill_keys($question_ids,
null)
150 $query = $this->db->query(
151 'SELECT qst_fi FROM ' . self::LINKING_TABLE_TEST_RANDOM
152 .
' WHERE tst_fi=' . $test_id
156 fn(\stdClass $v):
int => $v->qst_fi,
166 $general_question_properties = $this->question_properties_repo->getForParentObjectId($test->
getId());
168 $general_question_properties,
184 $this->question_properties_repo->getForQuestionIds($question_ids),
209 array $general_question_properties,
210 array $sequence_properties,
211 bool $delete_on_missing_sequence =
false
214 $general_question_properties,
216 $sequence_properties,
217 $delete_on_missing_sequence
220 || $delete_on_missing_sequence
221 && $sequence_properties[$v->getQuestionId()] === null) {
229 if ($sequence_properties[$v->getQuestionId()] !==
null) {
230 $question_properties = $question_properties
231 ->withSequenceInformation($sequence_properties[$v->getQuestionId()]);
234 $c[$v->getQuestionId()] = $question_properties;
const SEQUENCE_TABLE_TEST_RANDOM
buildQuestionPropertiesForFixedTest(\ilObjTest $test)
getSequencePropertiesForQuestionIds(array $question_ids)
getQuestionPropertiesForQuestionId(int $question_id)
Returns a Properties-objects if available.
getQuestionIdsForRandomTest(int $test_id)
buildQuestionPropertiesForRandomTest(\ilObjTest $test)
originalQuestionExists(int $question_id)
This is an adaptor to query the question pool if a question exists for the original_id of a given que...
getQuestionPropertiesForTest(\ilObjTest $test)
__construct(private readonly \ilDBInterface $db, private readonly GeneralQuestionPropertiesRepository $question_properties_repo)
getQuestionPropertiesWithAggregatedResultsForTest(\ilObjTest $test)
Returns an array of Properties-objects with AggregatedResultsProperties if available.
questionHasAnswers(int $question_id)
buildQuestionPropertiesFromGeneralQuestionPropertiesAndSquenceProperties(array $general_question_properties, array $sequence_properties, bool $delete_on_missing_sequence=false)
const LINKING_TABLE_TEST_FIXED
const LINKING_TABLE_TEST_RANDOM
const SEQUENCE_TABLE_TEST_FIXED
getQuestionPropertiesForQuestionIds(array $question_ids)
Returns an array of Properties-objects if available.
getTestId()
Gets the database id of the additional test data.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))