From 3271259e660605cc5d1ec34b73166c62182661eb Mon Sep 17 00:00:00 2001 From: Jane Adelmann Date: Thu, 5 May 2022 17:45:40 +0300 Subject: [PATCH] Fix filters for activity settings. --- classes/plagiarism_pchkorg_config_model.php | 25 +++++++++------------ version.php | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/classes/plagiarism_pchkorg_config_model.php b/classes/plagiarism_pchkorg_config_model.php index cfd7e50..6164f37 100644 --- a/classes/plagiarism_pchkorg_config_model.php +++ b/classes/plagiarism_pchkorg_config_model.php @@ -75,25 +75,20 @@ class plagiarism_pchkorg_config_model { public function get_filter_for_module($module, $name) { global $DB; - static $resultmap = array(); - // This will be called only once per module. - if (!array_key_exists($module, $resultmap)) { - $configs = $DB->get_records('plagiarism_pchkorg_config', array( - 'cm' => $module, - 'name' => $name - )); + $configs = $DB->get_records('plagiarism_pchkorg_config', array( + 'cm' => $module, + 'name' => $name, + )); - $value = null; - foreach ($configs as $record) { - if ($record->name === $name) { - $value = $record->value; - } + $value = null; + foreach ($configs as $record) { + if ($record->name === $name) { + $value = $record->value; + break; } - - $resultmap[$module] = $value; } - return $resultmap[$module]; + return $value; } /** diff --git a/version.php b/version.php index ea9fc16..6c20eec 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); if (!isset($plugin)) { $plugin = new stdClass(); } -$plugin->version = 2022050517; +$plugin->version = 2022050519; $plugin->requires = 2017051500; // Requires Moodle 3.3 . $plugin->release = 'v3.8.4'; $plugin->maturity = MATURITY_STABLE;