Skip to content

Commit

Permalink
fixup! MDL-82587 mod_quiz: Add slot version updated event
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron1729 committed Aug 1, 2024
1 parent fe8cf17 commit 4d9356a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/amd/build/question_slot.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/quiz/amd/build/question_slot.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion mod/quiz/amd/src/question_slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const setQuestionVersion = (slotId, newVersion) => fetchMany([{
*/
const registerEventListeners = () => {
document.addEventListener('change', e => {
window.console.log('changed');
if (!e.target.matches('[data-action="mod_quiz-select_slot"][data-slot-id]')) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/classes/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ public function update_slot_version(int $id, ?int $newversion): bool {
$context = $this->quizobj->get_context();
$refparams = ['usingcontextid' => $context->id, 'component' => 'mod_quiz', 'questionarea' => 'slot', 'itemid' => $slot->id];
$reference = $DB->get_record('question_references', $refparams, '*', MUST_EXIST);
$oldversion = (int)$reference->version;
$oldversion = is_null($reference->version) ? null : (int) $reference->version;
$reference->version = $newversion === 0 ? null : $newversion;
$existsparams = ['questionbankentryid' => $reference->questionbankentryid, 'version' => $newversion];
$versionexists = $DB->record_exists('question_versions', $existsparams);
Expand Down

0 comments on commit 4d9356a

Please sign in to comment.