Skip to content

Commit

Permalink
MDL-80233 completion: Use default for empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed Dec 12, 2023
1 parent a891866 commit 3f3dc5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion completion/classes/manager.php
Expand Up @@ -528,7 +528,7 @@ public function apply_default_completion($data, $updatecustomrules, string $suff
$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);
Expand Down
14 changes: 10 additions & 4 deletions completion/tests/behat/default_activity_completion.feature
Expand Up @@ -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"
Expand Down

0 comments on commit 3f3dc5a

Please sign in to comment.