diff --git a/completion/classes/manager.php b/completion/classes/manager.php index 67c0f0c52a5..25a86f27c4a 100644 --- a/completion/classes/manager.php +++ b/completion/classes/manager.php @@ -528,7 +528,7 @@ class manager { $data['customrules'] = $customdata ? json_encode($customdata) : null; $defaults['customrules'] = null; } - $data = array_intersect_key($data, $defaults); + $data = array_merge($defaults, $data); // Get names of the affected modules. list($modidssql, $params) = $DB->get_in_or_equal($modids); diff --git a/completion/tests/behat/default_activity_completion.feature b/completion/tests/behat/default_activity_completion.feature index 74896286e0b..892fbb23214 100644 --- a/completion/tests/behat/default_activity_completion.feature +++ b/completion/tests/behat/default_activity_completion.feature @@ -29,13 +29,19 @@ Feature: Allow teachers to edit the default activity completion rules in a cours And I set the field "Course completion tertiary navigation" to "Default activity completion" And I click on "Expand Assignment" "button" And I set the following fields to these values: - | Add requirements | 1 | - | completionview_assign | 0 | - | completionusegrade_assign | 1 | - | completionsubmit_assign | 1 | + | Add requirements | 1 | + | completionview_assign | 1 | + | completionusegrade_assign | 1 | + | completionsubmit_assign | 1 | And I should not see "Cancel" in the "[data-region='activitycompletion-forum']" "css_element" And I click on "Save changes" "button" in the "[data-region='activitycompletion-assign']" "css_element" Then I should see "Changes saved" + And I navigate to "Course completion" in current page administration + And I set the field "Course completion tertiary navigation" to "Default activity completion" + And I click on "Expand Assignment" "button" + And I set the following fields to these values: + | completionview_assign | 0 | + And I click on "Save changes" "button" in the "[data-region='activitycompletion-assign']" "css_element" And I am on "Course 1" course homepage with editing mode on And I press "Add an activity or resource" And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"