mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-40241 core_completion: Minor fixes to provided patch
Thanks to Aaron Barnes and Jon Sharp for working on this issue.
This commit is contained in:
parent
525d6ce397
commit
95d1a366ea
5 changed files with 51 additions and 59 deletions
|
@ -106,18 +106,18 @@ class behat_completion extends behat_base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Toggles completion tracking for course
|
||||
* Toggles completion tracking for course being in the course page.
|
||||
*
|
||||
* @When /^completion tracking is "(?P<completion_status_string>([Ee]nabled|[Dd]isabled)*)" in current course$/
|
||||
* @param string $completionstatus
|
||||
* @When /^completion tracking is "(?P<completion_status_string>Enabled|Disabled)" in current course$/
|
||||
* @param string $completionstatus The status, enabled or disabled.
|
||||
*/
|
||||
public function completion_is_toggled_in_course($completionstatus) {
|
||||
|
||||
$toggle = strtolower($completionstatus) == 'enabled' ? 'Yes' : 'No';
|
||||
$toggle = strtolower($completionstatus) == 'enabled' ? get_string('yes') : get_string('no');
|
||||
|
||||
return array(
|
||||
new Given('I follow "'.get_string('editsettings').'"'),
|
||||
new Given('I select "'.$toggle.'" from "'.get_string('enablecompletion', 'completion').'"'),
|
||||
new Given('I set the field "'.get_string('enablecompletion', 'completion').'" to "'.$toggle.'"'),
|
||||
new Given('I press "'.get_string('savechanges').'"')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
@core @core_completion
|
||||
Feature: Allow teachers to manually mark users as complete when configured
|
||||
In order for teachers to mark students as complete
|
||||
As a teacher
|
||||
I need to be able to use the completion report mark complete functionality
|
||||
In order for teachers to mark students as complete
|
||||
As a teacher
|
||||
I need to be able to use the completion report mark complete functionality
|
||||
|
||||
Scenario: Mark a student as complete using the completion report
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Completion course | CC1 | 0 |
|
||||
And the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
| teacher1 | Teacher | First | teacher1@example.com |
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| student1 | CC1 | student |
|
||||
| teacher1 | CC1 | editingteacher |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I am on homepage
|
||||
And I follow "Completion course"
|
||||
And completion tracking is "enabled" in current course
|
||||
And I follow "Course completion"
|
||||
And I check "Teacher"
|
||||
And I press "Save changes"
|
||||
And I turn editing mode on
|
||||
And I add the "Course completion status" block
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Completion course"
|
||||
And I should see "Status: Not yet started"
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I follow "Completion course"
|
||||
And I follow "View course report"
|
||||
And I should see "Student First"
|
||||
And I follow "Click to mark user complete"
|
||||
And I run the cron
|
||||
And I am on homepage
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I follow "Completion course"
|
||||
And I should see "Status: Complete"
|
||||
Scenario: Mark a student as complete using the completion report
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Completion course | CC1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | First | student1@example.com |
|
||||
| teacher1 | Teacher | First | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | CC1 | student |
|
||||
| teacher1 | CC1 | editingteacher |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| Enable completion tracking | 1 |
|
||||
And I am on homepage
|
||||
And I follow "Completion course"
|
||||
And completion tracking is "Enabled" in current course
|
||||
And I follow "Course completion"
|
||||
And I set the field "Teacher" to "1"
|
||||
And I press "Save changes"
|
||||
And I turn editing mode on
|
||||
And I add the "Course completion status" block
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Completion course"
|
||||
And I should see "Status: Not yet started"
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I follow "Completion course"
|
||||
And I follow "View course report"
|
||||
And I should see "Student First"
|
||||
And I follow "Click to mark user complete"
|
||||
And I trigger cron
|
||||
And I am on homepage
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I follow "Completion course"
|
||||
And I should see "Status: Complete"
|
||||
|
|
|
@ -34,7 +34,7 @@ $cmid = optional_param('id', 0, PARAM_INT);
|
|||
$courseid = optional_param('course', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
// Check if we are marking a user complete via the completion report
|
||||
// Check if we are marking a user complete via the completion report.
|
||||
$user = optional_param('user', 0, PARAM_INT);
|
||||
$rolec = optional_param('rolec', 0, PARAM_INT);
|
||||
|
||||
|
@ -56,7 +56,7 @@ if ($courseid) {
|
|||
|
||||
if (!$completion->is_enabled()) {
|
||||
throw new moodle_exception('completionnotenabled', 'completion');
|
||||
} elseif (!$completion->is_tracked_user($trackeduser)) {
|
||||
} else if (!$completion->is_tracked_user($trackeduser)) {
|
||||
throw new moodle_exception('nottracked', 'completion');
|
||||
}
|
||||
|
||||
|
|
|
@ -879,15 +879,6 @@ class behat_general extends behat_base {
|
|||
$this->getSession()->visit($this->locate_path('/admin/cron.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This step triggers cron like a user would do going to admin/cron.php (alias for "I trigger cron")
|
||||
*
|
||||
* @Given /^I run the cron$/
|
||||
*/
|
||||
public function i_run_the_cron() {
|
||||
$this->i_trigger_cron();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that an element and selector type exists in another element and selector type on the current page.
|
||||
*
|
||||
|
|
|
@ -672,7 +672,8 @@ foreach ($progress as $user) {
|
|||
)
|
||||
);
|
||||
|
||||
print '<a href="'.$toggleurl->out().'" title="'.get_string('clicktomarkusercomplete', 'report_completion').'"><img src="'.$OUTPUT->pix_url('i/completion-manual-'.($is_complete ? 'y' : 'n')).
|
||||
print '<a href="'.$toggleurl->out().'" title="'.get_string('clicktomarkusercomplete', 'report_completion').'">' .
|
||||
'<img src="'.$OUTPUT->pix_url('i/completion-manual-'.($is_complete ? 'y' : 'n')).
|
||||
'" alt="'.$describe.'" class="icon" /></a></td>';
|
||||
} else {
|
||||
print '<img src="'.$OUTPUT->pix_url('i/'.$completionicon).'" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" /></td>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue