Skip to content

Commit

Permalink
MDL-58138 completion: consolidate bulk edit notifications to single call
Browse files Browse the repository at this point in the history
Part of MDL-58138 epic
  • Loading branch information
snake committed Apr 19, 2017
1 parent 5976f85 commit 22002ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions completion/classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ public function apply_completion($data, $updateinstances) {
foreach ($updated as $cmid) {
$completion->reset_all_state($modinfo->get_cm($cmid));
}

// And notify the user of the result.
\core\notification::add(get_string('activitycompletionupdated', 'core_completion'), \core\notification::SUCCESS);
}
}

Expand Down Expand Up @@ -368,8 +371,6 @@ protected function apply_completion_cm(\cm_info $cm, $data, $updateinstance) {

\core\event\course_module_updated::create_from_cm($cm, $cm->context)->trigger();

\core\notification::add(get_string('completionupdated', 'completion', $cm->get_formatted_name()),
\core\notification::SUCCESS);
return true;
}

Expand Down Expand Up @@ -421,10 +422,9 @@ public function apply_default_completion($data, $updatecustomrules) {
'context' => $coursecontext,
'other' => ['modulename' => $modules[$modid]],
])->trigger();
// Add notification.
\core\notification::add(get_string('defaultcompletionupdated', 'completion',
get_string("modulenameplural", $modules[$modid])), \core\notification::SUCCESS);
}
// Add notification.
\core\notification::add(get_string('defaultcompletionupdated', 'completion'), \core\notification::SUCCESS);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions completion/tests/behat/bulk_edit_activity_completion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ Feature: Allow teachers to bulk edit activity completion rules in a course.
And I click on "completionusegrade" "checkbox"
And I click on "completionsubmit" "checkbox"
And I click on "Save changes" "button"
Then I should see "Updated completion for activity Test assignment one"
And I should see "Updated completion for activity Test assignment two"
Then I should see "Changes saved"
And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
And I should see "Student must view this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
And I should see "Student must receive a grade to complete this activity" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
Expand Down
3 changes: 1 addition & 2 deletions completion/tests/behat/default_activity_completion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ Feature: Allow teachers to bulk edit activity completion rules in a course.
And I click on "completionusegrade" "checkbox"
And I click on "completionsubmit" "checkbox"
And I click on "Save changes" "button"
#Then I should see "Updated completion for activity Test assignment one"
#And I should see "Updated completion for activity Test assignment two"
Then I should see "Changes saved"
And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
And I should see "Student must view this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
And I should see "Student must receive a grade to complete this activity" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
Expand Down
3 changes: 2 additions & 1 deletion lang/en/completion.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$string['activitiescompleted'] = 'Activity completion';
$string['activitiescompletednote'] = 'Note: Activity completion must be set for an activity to appear in the above list.';
$string['activitycompletion'] = 'Activity completion';
$string['activitycompletionupdated'] = 'Changes saved';
$string['affectedactivities'] = 'The changes will affect the following <b>{$a}</b> Activities/Resources';
$string['aggregationmethod'] = 'Aggregation method';
$string['all'] = 'All';
Expand Down Expand Up @@ -126,7 +127,7 @@
$string['days'] = 'Days';
$string['daysoftotal'] = '{$a->days} of {$a->total}';
$string['defaultcompletion'] = 'Default activity completion';
$string['defaultcompletionupdated'] = 'Updated default completion for future <b>{$a}</b> in this course';
$string['defaultcompletionupdated'] = 'Changes saved';
$string['deletecompletiondata'] = 'Delete completion data';
$string['dependencies'] = 'Dependencies';
$string['dependenciescompleted'] = 'Completion of other courses';
Expand Down

0 comments on commit 22002ed

Please sign in to comment.