Skip to content

Commit

Permalink
bugfix for "Codingerror completion\custum_completion" (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
semteacher committed Dec 20, 2024
1 parent c11e8f3 commit 2d934e4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
8 changes: 8 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3961,5 +3961,13 @@ function xmldb_booking_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2024121701, 'booking');
}

if ($oldversion < 2024122002) {
// Remove values form completiongradeitemnumber and completionpassgrade to avoid #779 error after #629.
remove_completiongradeitemnumber_2024122002();

// Booking savepoint reached.
upgrade_mod_savepoint(true, 2024122002, 'booking');
}

return true;
}
22 changes: 22 additions & 0 deletions db/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,25 @@ function fix_places_for_booking_answers() {
// Execute the query.
$DB->execute($sql, $params);
}

/**
* Remove values form completiongradeitemnumber and completionpassgrade to avoid #779 error after #629.
*
* @return void
*/
function remove_completiongradeitemnumber_2024122002() {
global $DB;

$bookingmoduleid = $DB->get_field('modules', 'id', ['name' => 'booking']);

// Define your SQL update query.
$sql = "UPDATE {course_modules}
SET completiongradeitemnumber = null, completionpassgrade = 0
WHERE module = :bookigmodules";

// Define the parameters for the query.
$params = ['bookigmodules' => $bookingmoduleid];

// Execute the query.
$DB->execute($sql, $params);
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024122000;
$plugin->version = 2024122002;
$plugin->requires = 2022112800; // Requires this Moodle version. Current: Moodle 4.1.
$plugin->release = '8.9.2';
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit 2d934e4

Please sign in to comment.