Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/ILIAS/Test/src/Setup/Test11DBUpdateSteps.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,14 @@ public function step_3(): void
$this->db->modifyTableColumn('tst_test_settings', $column, ['length' => 8]);
}
}

public function step_4(): void
{
$table = 'qpl_a_cloze';
$column = 'answertext';
if ($this->db->tableExists($table) && $this->db->tableColumnExists($table, $column)) {
$this->db->manipulate("UPDATE {$table} SET {$column} = '' WHERE {$column} IS NULL");
$this->db->modifyTableColumn($table, $column, ['default' => '', 'notnull' => true]);
}
}
}
76 changes: 38 additions & 38 deletions components/ILIAS/TestQuestionPool/classes/class.assClozeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,24 +311,24 @@ protected function saveClozeTextGapRecordToDb(
$this->db->manipulateF(
'INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
[
'integer',
'integer',
'integer',
'text',
'float',
'integer',
'text',
'integer'
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_FLOAT,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_INTEGER
],
[
$next_id,
$this->getId(),
$key,
strlen($item->getAnswertext()) ? $item->getAnswertext() : '',
$item->getAnswertext(),
$item->getPoints(),
$item->getOrder(),
$gap->getType(),
(int) $gap->getGapSize()
$gap->getGapSize()
]
);
}
Expand All @@ -342,24 +342,24 @@ protected function saveClozeSelectGapRecordToDb(
$this->db->manipulateF(
'INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, shuffle) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
[
'integer',
'integer',
'integer',
'text',
'float',
'integer',
'text',
'text'
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_FLOAT,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_TEXT
],
[
$next_id,
$this->getId(),
$key,
strlen($item->getAnswertext()) ? $item->getAnswertext() : '',
$item->getAnswertext(),
$item->getPoints(),
$item->getOrder(),
$gap->getType(),
($gap->getShuffle()) ? '1' : '0'
$gap->getShuffle() ? '1' : '0'
]
);
}
Expand All @@ -375,32 +375,32 @@ protected function saveClozeNumericGapRecordToDb(
$this->db->manipulateF(
'INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, lowerlimit, upperlimit, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
[
'integer',
'integer',
'integer',
'text',
'float',
'integer',
'text',
'text',
'text',
'integer'
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_FLOAT,
ilDBConstants::T_INTEGER,
ilDBConstants::T_TEXT,
ilDBConstants::T_TEXT,
ilDBConstants::T_TEXT,
ilDBConstants::T_INTEGER
],
[
$next_id,
$this->getId(),
$key,
strlen($item->getAnswertext()) ? $item->getAnswertext() : '',
$item->getAnswertext(),
$item->getPoints(),
$item->getOrder(),
$gap->getType(),
($eval->e($item->getLowerBound()) !== false && strlen(
$item->getLowerBound()
) > 0) ? $item->getLowerBound() : $item->getAnswertext(),
($eval->e($item->getUpperBound()) !== false && strlen(
$item->getUpperBound()
) > 0) ? $item->getUpperBound() : $item->getAnswertext(),
(int) $gap->getGapSize()
($eval->e($item->getLowerBound()) !== false && ($item->getLowerBound() ?? '') !== '')
? $item->getLowerBound()
: $item->getAnswertext(),
($eval->e($item->getUpperBound()) !== false && ($item->getUpperBound() ?? '') !== '')
? $item->getUpperBound()
: $item->getAnswertext(),
$gap->getGapSize()
]
);
}
Expand Down