19 declare(strict_types=1);
49 $this->question_properties_repo->getForQuestionIds($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
230 $question_properties = $question_properties
buildQuestionPropertiesForFixedTest(\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...
questionHasAnswers(int $question_id)
__construct(private readonly \ilDBInterface $db, private readonly GeneralQuestionPropertiesRepository $question_properties_repo)
getTestId()
Gets the database id of the additional test data.
const LINKING_TABLE_TEST_RANDOM
getQuestionPropertiesForTest(\ilObjTest $test)
isRandomTest()
Returns the fact wether this test is a random questions test or not.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getQuestionPropertiesWithAggregatedResultsForTest(\ilObjTest $test)
Returns an array of Properties-objects with AggregatedResultsProperties if available.
buildQuestionPropertiesFromGeneralQuestionPropertiesAndSquenceProperties(array $general_question_properties, array $sequence_properties, bool $delete_on_missing_sequence=false)
getQuestionPropertiesForQuestionIds(array $question_ids)
Returns an array of Properties-objects if available.
buildQuestionPropertiesForRandomTest(\ilObjTest $test)
const SEQUENCE_TABLE_TEST_RANDOM
getQuestionIdsForRandomTest(int $test_id)
const LINKING_TABLE_TEST_FIXED
const SEQUENCE_TABLE_TEST_FIXED
getSequencePropertiesForQuestionIds(array $question_ids)
withSequenceInformation(PropertySequence $sequence)
getQuestionPropertiesForQuestionId(int $question_id)
Returns a Properties-objects if available.