From 67e9ebdf761cd54d88054ae78a5718a1e09a7a5b Mon Sep 17 00:00:00 2001 From: spinozarabel <16438408+spinozarabel@users.noreply.github.com> Date: Sat, 11 Jul 2020 10:26:58 -0700 Subject: [PATCH 1/3] added new config setting, added language strings, changed lib.php to include hidden courses based on setting --- lang/en/block_grade_me.php | 2 ++ lib.php | 14 +++++++++++--- settings.php | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lang/en/block_grade_me.php b/lang/en/block_grade_me.php index cbda12c..f6c4a6f 100644 --- a/lang/en/block_grade_me.php +++ b/lang/en/block_grade_me.php @@ -37,6 +37,8 @@ $string['settings_configmaxcourses'] = 'Set the maximum number of ungraded courses to show. Setting this too high may impact performance.'; $string['settings_adminviewall'] = 'Admins View All'; $string['settings_configadminviewall'] = 'Enable to give administrators the rights to see all ungraded work — not just for courses where they have a grader role.'; +$string['settings_hiddencourses'] = 'Hidden courses also to be searched for ungraded work'; +$string['settings_confighiddencourses'] = 'Include hidden courses also to be searched for ungraded work'; $string['settings_enablepre'] = 'Show'; $string['settings_configenablepre'] = 'Should Grade Me show unrated activity from the "{$a->plugin_name}" module?'; diff --git a/lib.php b/lib.php index 0cb7edd..92d560d 100644 --- a/lib.php +++ b/lib.php @@ -248,18 +248,26 @@ function block_grade_me_cache_grade_data() { or b.pagetypepattern = ?)"; $systemblock = $DB->get_record_sql($sqlsystem, $paramsystem); $systemcount = $systemblock->bcount; - // Get the list of all active courses in the database. + // Get the list of all courses in the database depending on config vivible setting + if ($CFG->block_grade_me_includehiddencourses) + { + $show = '0'; + } + else + { + $show = '1'; + } $paramscourse = array(); if ($systemcount > '0') { $sqlactive = "SELECT c.id, c.timemodified FROM {course} c - WHERE c.visible = '1'"; + WHERE (c.visible = '1' or c.visible = $show)"; } else { $sqlactive = "SELECT c.id, c.timemodified FROM {course} c JOIN {context} x ON c.id = x.instanceid JOIN {block_instances} b ON b.parentcontextid = x.id - WHERE b.blockname = 'grade_me' and c.visible = '1'"; + WHERE b.blockname = 'grade_me' and (c.visible = '1' or c.visible = $show)"; } $courselist = $DB->get_recordset_sql($sqlactive, $paramscourse); foreach ($courselist as $actcourse) { diff --git a/settings.php b/settings.php index cc6507d..37e5ad7 100644 --- a/settings.php +++ b/settings.php @@ -20,6 +20,10 @@ $settings->add(new admin_setting_configcheckbox('block_grade_me_enableadminviewall', get_string('settings_adminviewall', 'block_grade_me'), get_string('settings_configadminviewall', 'block_grade_me'), 0)); + + // new setting added to include hidden courses to also be searched for gradeable activities + $settings->add(new admin_setting_configcheckbox('block_grade_me_includehiddencourses', + get_string('settings_hiddencourses', 'block_grade_me'), get_string('settings_confighiddencourses', 'block_grade_me'), 0)); $settings->add(new admin_setting_configtext('block_grade_me_maxcourses', get_string('settings_maxcourses', 'block_grade_me'), get_string('settings_configmaxcourses', 'block_grade_me'), 10, PARAM_INT)); From ebd180b996c3da41c7f9d78f5670dbdbde6df4dd Mon Sep 17 00:00:00 2001 From: spinozarabel <16438408+spinozarabel@users.noreply.github.com> Date: Fri, 17 Jul 2020 13:04:26 -0700 Subject: [PATCH 2/3] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b27abd..1fe48b8 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,7 @@ To help developers debug problems, please include the following in all issues: - Database software and versions. - Any other environmental information available. -Developers will triage issues and deal with more serious problems first. We will try to address all issues but cannot guarantee when your issue will be addressed. \ No newline at end of file +Developers will triage issues and deal with more serious problems first. We will try to address all issues but cannot guarantee when your issue will be addressed. + +## What is different in this branch (Madhu Avasarala) +- This branch is customized to add a config setting to include hidden courses. If selected, hidden courses will also be searched for ungraded items. From c9457d216f32a4c83a72ff932676d73ff314254b Mon Sep 17 00:00:00 2001 From: spinozarabel <16438408+spinozarabel@users.noreply.github.com> Date: Thu, 24 Sep 2020 14:56:50 -0700 Subject: [PATCH 3/3] tasks.php and readme.md updated for 30m instead of 15m --- README.md | 1 + db/tasks.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1fe48b8..a716472 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,4 @@ Developers will triage issues and deal with more serious problems first. We will ## What is different in this branch (Madhu Avasarala) - This branch is customized to add a config setting to include hidden courses. If selected, hidden courses will also be searched for ungraded items. +- The db/tasks.php file has been edited to set the update time for 30m every hour and reset every day at 03:15 diff --git a/db/tasks.php b/db/tasks.php index a2430b7..0c76d5b 100644 --- a/db/tasks.php +++ b/db/tasks.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Every day 1t 03:15 server time, a reset is done + * Every hour of every day at 30m intervals, the cache is updated with grade activities due * @package block_grade_me * @copyright 2017 Derek Henderson {@link http://www.remote-learner.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -25,7 +27,7 @@ array( 'classname' => 'block_grade_me\task\cache_grade_data', 'blocking' => 0, - 'minute' => '*/15', + 'minute' => '*/30', 'hour' => '*', 'day' => '*', 'dayofweek' => '*', @@ -35,7 +37,7 @@ 'classname' => 'block_grade_me\task\reset_block', 'blocking' => 0, 'minute' => '15', - 'hour' => '1', + 'hour' => '3', 'day' => '*', 'dayofweek' => '*', 'month' => '*'