Skip to content

Commit

Permalink
Minor fixes for codings styles - Moodle Code Checker
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviervalentin committed Jun 3, 2024
1 parent 63957fa commit 2c2da24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions classes/task/run_clean_reports_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public function execute() {
// Check if orphaned submissions is disabled, clean whole table.
if (get_config('report_coursemanager', 'enable_orphans_task') == 0) {
$purgereports = $DB->delete_records('report_coursemanager_orphans', []);
}
}

// 2- Select all courses having reports in general reports table and check if course exists.
$sqllistcourseswithreports = 'SELECT DISTINCT(course) AS courseid
FROM {report_coursemanager_reports} c
';
$listcourseswithreports = $DB->get_records_sql($sqllistcourseswithreports);

foreach($listcourseswithreports as $clean) {
foreach ($listcourseswithreports as $clean) {
// If course doesn't exist (deleted by admin), delete all reports in tables.
if (!$DB->record_exists('course', ['id' => $clean->courseid])) {
$purgereports = $DB->delete_records('report_coursemanager_reports', ['course' => $clean->courseid]);
Expand All @@ -94,7 +94,8 @@ public function execute() {
$cm = get_coursemodule_from_id('assign', $assign->cmid);
if (!$cm) {
// If coursemodule not found, assign has probably been deleted. Delete report.
$purgereports = $DB->delete_records('report_coursemanager_orphans', ['course' => $assign->course, 'cmid' => $assign->cmid]);
$purgereports = $DB->delete_records('report_coursemanager_orphans',
['course' => $assign->course, 'cmid' => $assign->cmid]);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ function xmldb_report_coursemanager_upgrade($oldversion) {
// HOTFIX : error in courses without teachers admin page.
upgrade_plugin_savepoint(true, 2024050305, 'report', 'coursemanager');
}
if ($oldversion < 2024050309) {
if ($oldversion < 2024060301) {
// Version 3.2.2.
// Add clkeaning task and fixes several bugs.
upgrade_plugin_savepoint(true, 2024050309, 'report', 'coursemanager');
// Add cleaning task and fixes several bugs.
upgrade_plugin_savepoint(true, 2024060301, 'report', 'coursemanager');
}
return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

$plugin->version = 2024050309;
$plugin->version = 2024060301;
$plugin->release = '3.2.2';
$plugin->requires = 2020061516;
$plugin->component = 'report_coursemanager';
Expand Down

0 comments on commit 2c2da24

Please sign in to comment.