Skip to content

Commit

Permalink
Fetch users list method improved
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Feb 14, 2024
1 parent e108ef2 commit 30829f4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion actions/notification/classes/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ protected function get_users_withroles(array $roles, $context, $childuserid=null
list($insql, $inparams) = $DB->get_in_or_equal($roles, SQL_PARAMS_NAMED, 'rle');

// TODO: Define user fields, never get entire fields.
$rolesql = "SELECT u.*, ra.id, ra.roleid FROM {role_assignments} ra
$rolesql = "SELECT ra.id as assignid, u.*, ra.roleid FROM {role_assignments} ra
JOIN {user} u ON u.id = ra.userid
JOIN {role} r ON ra.roleid = r.id
LEFT JOIN {role_names} rn ON (rn.contextid = :ctxid AND rn.roleid = r.id) ";
Expand Down
1 change: 1 addition & 0 deletions classes/automation/instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ public function find_user_completion_conditions($conditions, $instancedata, $use
}
}

// If one or more conditions are enabled then the result of completion condition should be same as enabled.
return ($enabled == $result) ? true : false;
}

Expand Down
22 changes: 11 additions & 11 deletions classes/plugininfo/pulsecondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,31 @@ public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $h
* @return array $subplugins.
*/
public function get_plugins_list() {
$actionplugins = \core_component::get_plugin_list('pulsecondition');
return $actionplugins;
$conditionplugins = \core_component::get_plugin_list('pulsecondition');
return $conditionplugins;
}

/**
* Get the list of action plugins woithj its base class.
* Get the list of condition plugins with its base class instance.
*/
public function get_plugins_base() {
$plugins = $this->get_plugins_list();

if (!empty($plugins)) {
foreach ($plugins as $componentname => $pluginpath) {
$instance = $this->get_plugin($componentname);
$actions[$componentname] = $instance;
$conditions[$componentname] = $instance;
}
}

return $actions ?? [];
return $conditions ?? [];
}

/**
* Get the action component actionform instance.
* Get the condtion component actionform instance.
*
* @param string $componentname
* @return \actionform
* @return \conditionform
*/
public function get_plugin($componentname) {

Expand Down Expand Up @@ -143,13 +143,13 @@ public static function instance() {
* @return stdclass
*/
public static function get_list() {
static $actionplugins = null;
static $conditionplugins = null;

if (!$actionplugins) {
$actionplugins = new self();
if (!$conditionplugins) {
$conditionplugins = new self();
}

$plugins = $actionplugins->get_plugins_base();
$plugins = $conditionplugins->get_plugins_base();
return $plugins;
}
}
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->component = 'mod_pulse';
$plugin->version = 2023100704;
$plugin->version = 2023100705;
$plugin->requires = 2020061500; // Requires Moodle 3.90.
$plugin->release = 'v2.0';
$plugin->maturity = MATURITY_RC;
Expand Down

0 comments on commit 30829f4

Please sign in to comment.