mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
MDL-75173 core_completion: Fix course completion criteria marking.
SQL was fetching activities where completion state was 'completed, but not passed reqyured grade'. For course completion such states must be ignored. Also fixed progress bar on my courses page. Same reasoning as above.
This commit is contained in:
parent
e4c5a12a1c
commit
def5d29730
3 changed files with 95 additions and 3 deletions
|
@ -151,7 +151,6 @@ class api {
|
||||||
AND (
|
AND (
|
||||||
mc.completionstate = :completionstate
|
mc.completionstate = :completionstate
|
||||||
OR mc.completionstate = :completionstatepass
|
OR mc.completionstate = :completionstatepass
|
||||||
OR mc.completionstate = :completionstatefail
|
|
||||||
)";
|
)";
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
|
@ -159,7 +158,6 @@ class api {
|
||||||
'contextlevel' => CONTEXT_COURSE,
|
'contextlevel' => CONTEXT_COURSE,
|
||||||
'completionstate' => COMPLETION_COMPLETE,
|
'completionstate' => COMPLETION_COMPLETE,
|
||||||
'completionstatepass' => COMPLETION_COMPLETE_PASS,
|
'completionstatepass' => COMPLETION_COMPLETE_PASS,
|
||||||
'completionstatefail' => COMPLETION_COMPLETE_FAIL
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($userdata) {
|
if ($userdata) {
|
||||||
|
|
|
@ -80,7 +80,11 @@ class progress {
|
||||||
$completed = 0;
|
$completed = 0;
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$data = $completion->get_data($module, true, $userid);
|
$data = $completion->get_data($module, true, $userid);
|
||||||
$completed += $data->completionstate == COMPLETION_INCOMPLETE ? 0 : 1;
|
if (($data->completionstate == COMPLETION_INCOMPLETE) || ($data->completionstate == COMPLETION_COMPLETE_FAIL)) {
|
||||||
|
$completed += 0;
|
||||||
|
} else {
|
||||||
|
$completed += 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($completed / $count) * 100;
|
return ($completed / $count) * 100;
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
@block @block_completionstatus @javascript
|
||||||
|
Feature: Course completion state should match completion criteria
|
||||||
|
In order to understand the configuration or status of an course's completion
|
||||||
|
As a user
|
||||||
|
I need to see the appropriate completion information on course and dashboard pages
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email | idnumber |
|
||||||
|
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||||
|
| teacher2 | Teacher | 2 | teacher1@example.com | T2 |
|
||||||
|
| student1 | Student | 1 | student1@example.com | S1 |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname | category | enablecompletion | showcompletionconditions |
|
||||||
|
| Course 1 | C1 | 0 | 1 | 1 |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| teacher1 | C1 | editingteacher |
|
||||||
|
| teacher2 | C1 | teacher |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
And the following "activity" exists:
|
||||||
|
| activity | assign |
|
||||||
|
| course | C1 |
|
||||||
|
| section | 1 |
|
||||||
|
| name | Test assignment name |
|
||||||
|
| intro | Submit your online text |
|
||||||
|
| completion | 1 |
|
||||||
|
| assignsubmission_onlinetext_enabled | 1 |
|
||||||
|
| grade[modgrade_type] | Point |
|
||||||
|
| grade[modgrade_point] | 100 |
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I am on "Course 1" course homepage with editing mode on
|
||||||
|
And I navigate to "Course completion" in current page administration
|
||||||
|
And I click on "Condition: Activity completion" "link"
|
||||||
|
And I set the field "Assignment - Test assignment name" to "1"
|
||||||
|
And I press "Save changes"
|
||||||
|
And I add the "Course completion status" block
|
||||||
|
And I am on the "Test assignment name" "assign activity" page
|
||||||
|
And I navigate to "Settings" in current page administration
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Completion tracking | Show activity as complete when conditions are met |
|
||||||
|
| completionusegrade | 1 |
|
||||||
|
| completionpassgrade | 1 |
|
||||||
|
| gradepass | 70 |
|
||||||
|
And I press "Save and return to course"
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
Scenario: Completion status show match completion criteria.
|
||||||
|
Given I log in as "student1"
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "todo"
|
||||||
|
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "todo"
|
||||||
|
And I should see "Status: Not yet started" in the "Course completion status" "block"
|
||||||
|
And I am on the "Test assignment name" "assign activity" page
|
||||||
|
And I press "Add submission"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Online text | I'm the student1 submission |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I press "Submit assignment"
|
||||||
|
And I press "Continue"
|
||||||
|
And I log out
|
||||||
|
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
|
||||||
|
And I follow "View all submissions"
|
||||||
|
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Grade out of 100 | 50.0 |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I log out
|
||||||
|
When I log in as "student1"
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And I should see "Status: Pending" in the "Course completion status" "block"
|
||||||
|
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
|
||||||
|
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "failed"
|
||||||
|
And I am on the "My courses" page
|
||||||
|
And I should not see "100%" in the "Course overview" "block"
|
||||||
|
And I log out
|
||||||
|
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
|
||||||
|
And I follow "View all submissions"
|
||||||
|
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Grade out of 100 | 75.0 |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student1"
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And I should see "Status: Complete" in the "Course completion status" "block"
|
||||||
|
And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
|
||||||
|
And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "done"
|
||||||
|
And I am on the "My courses" page
|
||||||
|
Then I should see "100%" in the "Course overview" "block"
|
Loading…
Add table
Add a link
Reference in a new issue