Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: catalyst/moodle-tool_dynamic_cohorts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ed2458496e01d938d7abbd5a920a33f421758ef4
Choose a base ref
..
head repository: catalyst/moodle-tool_dynamic_cohorts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0d1aed1f3a2e61aa58e7528a6c5be7d0d3e08fd6
Choose a head ref
Showing with 5 additions and 7 deletions.
  1. +5 −7 classes/local/tool_dynamic_cohorts/condition/user_enrolment.php
12 changes: 5 additions & 7 deletions classes/local/tool_dynamic_cohorts/condition/user_enrolment.php
Original file line number Diff line number Diff line change
@@ -208,7 +208,7 @@ public function get_broken_description(): string {
global $DB;

// Missing role.
if (!$DB->get_record('role', ['id' => $this->get_roleid_value()])) {
if (!array_key_exists($this->get_roleid_value(), $this->get_roles())) {
return get_string('missingrole', 'tool_dynamic_cohorts');
}

@@ -218,8 +218,7 @@ public function get_broken_description(): string {
}

// Missing enrolment method.
if (!empty($this->get_enrolment_method_value())
&& !array_key_exists($this->get_enrolment_method_value(), $this->get_enrolment_methods())) {
if (!array_key_exists($this->get_enrolment_method_value(), $this->get_enrolment_methods())) {
return get_string('missingenrolmentmethod', 'tool_dynamic_cohorts', $this->get_enrolment_method_value());
}

@@ -305,7 +304,7 @@ public function is_broken(): bool {

if ($this->get_config_data()) {
// Check role exists.
if (!empty($this->get_roleid_value()) && !$DB->get_record('role', ['id' => $this->get_roleid_value()])) {
if (!array_key_exists($this->get_roleid_value(), $this->get_roles())) {
return true;
}

@@ -314,9 +313,8 @@ public function is_broken(): bool {
return true;
}

// Enrolment method is not valid.
if (!empty($this->get_enrolment_method_value())
&& !array_key_exists($this->get_enrolment_method_value(), $this->get_enrolment_methods())) {
// Check enrolment method exists.
if (!array_key_exists($this->get_enrolment_method_value(), $this->get_enrolment_methods())) {
return true;
}
}