19 declare(strict_types=1);
98 $this->process_locker_factory->setUserId($this->
getUserId());
101 $this->process_locker_factory->setQuestionId($question_id);
102 $processLocker = $this->process_locker_factory->getLocker();
104 $processLocker->executeUserTestResultUpdateLockOperation(
function () use ($question_id) {
117 if ($source_pass !==
null) {
140 $res = $this->db->execute(
147 while ($row = $this->db->fetchAssoc(
$res)) {
148 if ($source_pass ===
null) {
149 $source_pass = $row[
'pass'];
150 } elseif ($row[
'pass'] < $source_pass) {
154 $solution_id = $this->db->nextId(
'tst_solutions');
158 $row[
'points'], $row[
'value1'], $row[
'value2']
167 $res = $this->db->execute(
172 $row = $this->db->fetchAssoc(
$res);
174 $result_id = $this->db->nextId(
'tst_test_result');
178 $row[
'points'], $row[
'manual'], $row[
'hint_count'], $row[
'hint_points'], $row[
'answered']
184 if (self::$prepared_delete_solution_records_statement ===
null) {
185 self::$prepared_delete_solution_records_statement = $this->db->prepareManip(
186 "DELETE FROM tst_solutions WHERE active_fi = ? AND question_fi = ? AND pass = ?",
187 [
'integer',
'integer',
'integer']
191 return self::$prepared_delete_solution_records_statement;
196 if (self::$prepared_select_solution_records_statement ===
null) {
198 SELECT pass, points, value1, value2 FROM tst_solutions 199 WHERE active_fi = ? AND question_fi = ? AND pass < ? ORDER BY pass DESC 202 self::$prepared_select_solution_records_statement = $this->db->prepare(
204 [
'integer',
'integer',
'integer']
208 return self::$prepared_select_solution_records_statement;
213 if (self::$prepared_insert_solution_record_statement ===
null) {
215 INSERT INTO tst_solutions ( 216 solution_id, active_fi, question_fi, pass, tstamp, points, value1, value2 218 ?, ?, ?, ?, ?, ?, ?, ? 222 self::$prepared_insert_solution_record_statement = $this->db->prepareManip(
224 [
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'text',
'text']
228 return self::$prepared_insert_solution_record_statement;
233 if (self::$prepared_delete_result_record_statement ===
null) {
234 self::$prepared_delete_result_record_statement = $this->db->prepareManip(
235 "DELETE FROM tst_test_result WHERE active_fi = ? AND question_fi = ? AND pass = ?",
236 [
'integer',
'integer',
'integer']
240 return self::$prepared_delete_result_record_statement;
245 if (self::$prepared_select_result_record_statement ===
null) {
247 SELECT points, manual, hint_count, hint_points, answered FROM tst_test_result 248 WHERE active_fi = ? AND question_fi = ? AND pass = ? 251 self::$prepared_select_result_record_statement = $this->db->prepare(
253 [
'integer',
'integer',
'integer']
257 return self::$prepared_select_result_record_statement;
262 if (self::$prepared_insert_result_record_statement ===
null) {
264 INSERT INTO tst_test_result ( 265 test_result_id, active_fi, question_fi, pass, tstamp, 266 points, manual, hint_count, hint_points, answered 268 ?, ?, ?, ?, ?, ?, ?, ?, ?, ? 272 self::$prepared_insert_result_record_statement = $this->db->prepareManip(
274 [
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer']
278 return self::$prepared_insert_result_record_statement;
static ilDBStatement $prepared_select_solution_records_statement
getPreparedInsertSolutionRecordStatement()
resetTargetResult(int $question_id)
setActiveId(int $active_id)
getPreparedInsertResultRecordStatement()
adoptSourceResult(int $question_id, int $source_pass)
static ilDBStatement $prepared_insert_result_record_statement
getPreparedSelectResultRecordStatement()
static ilDBStatement $prepared_delete_result_record_statement
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setQuestionIds(array $question_ids)
setTargetPass(int $target_pass)
adoptSourceSolution(int $question_id)
ilAssQuestionProcessLockerFactory $process_locker_factory
resetTargetSolution(int $question_id)
static ilDBStatement $prepared_delete_solution_records_statement
getPreparedDeleteResultRecordStatement()
static ilDBStatement $prepared_select_result_record_statement
static ilDBStatement $prepared_insert_solution_record_statement
adoptQuestionAnswer(int $question_id)
getPreparedDeleteSolutionRecordsStatement()
getPreparedSelectSolutionRecordsStatement()
__construct(private ilDBInterface $db, ilSetting $ass_settings)