MDL-47243 core_grades: Add behat tests for outcomes in Natural

This commit is contained in:
John Okely 2014-10-13 15:01:59 +08:00
parent 5e18456631
commit 3087835ae3
2 changed files with 123 additions and 2 deletions

View File

@ -742,7 +742,6 @@ class grade_report_grader extends grade_report {
$strftimedatetimeshort = get_string('strftimedatetimeshort');
$strexcludedgrades = get_string('excluded', 'grades');
$strerror = get_string('error');
$strtypescale = get_string('typescale', 'grades');
foreach ($this->gtree->get_levels() as $key => $row) {
$headingrow = new html_table_row();
@ -991,7 +990,9 @@ class grade_report_grader extends grade_report {
$nogradestr = $this->get_lang_string('nooutcome', 'grades');
}
$attributes = array('tabindex' => $tabindices[$item->id]['grade'], 'id'=>'grade_'.$userid.'_'.$item->id);
$itemcell->text .= html_writer::label($strtypescale, $attributes['id'], false,
$gradelabel = $fullname . ' ' . $item->itemname;
$itemcell->text .= html_writer::label(
get_string('useractivitygrade', 'gradereport_grader', $gradelabel), $attributes['id'], false,
array('class' => 'accesshide'));
$itemcell->text .= html_writer::select($scaleopt, 'grade['.$userid.']['.$item->id.']', $gradeval, array(-1=>$nogradestr), $attributes);
} else if (!empty($scale)) {

View File

@ -246,6 +246,126 @@ Feature: We can use calculated grade totals
And I set the field "Grade report" to "Overview report"
And I should see "50.00 (50.00 %)" in the "overview-grade" "table"
@javascript
Scenario: Natural aggregation on outcome items with natural weights
And I log out
And I log in as "admin"
And I set the following administration settings values:
| Enable outcomes | 1 |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome 1 | OT1 | C1 | Test Scale |
And the following "grade items" exist:
| itemname | course | outcome | gradetype | scale |
| Test outcome item one | C1 | OT1 | Scale | Test Scale |
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I follow "Grader report"
And I turn editing mode on
And I press "Save changes"
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
And I navigate to "Course grade settings" node in "Grade administration > Setup"
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Grades"
Then "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I set the field "Grade report" to "Overview report"
And I should see "114.82 (18.27 %)" in the "overview-grade" "table"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Test outcome item one":
| Extra credit | 1 |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Grades"
Then "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I set the field "Grade report" to "Overview report"
And I should see "114.00 (18.39 %)" in the "overview-grade" "table"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Include outcomes in aggregation | 0 |
And I set the following settings for grade item "Test outcome item one":
| Extra credit | 0 |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Grades"
Then "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I set the field "Grade report" to "Overview report"
And I should see "110.00 (17.74 %)" in the "overview-grade" "table"
@javascript
Scenario: Natural aggregation on outcome items with modified weights
And I log out
And I log in as "admin"
And I set the following administration settings values:
| Enable outcomes | 1 |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome 1 | OT1 | C1 | Test Scale |
And the following "grade items" exist:
| itemname | course | outcome | gradetype | scale |
| Test outcome item one | C1 | OT1 | Scale | Test Scale |
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test outcome item one":
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
And I follow "Grader report"
And I turn editing mode on
And I press "Save changes"
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
And I navigate to "Course grade settings" node in "Grade administration > Setup"
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Grades"
Then "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I set the field "Grade report" to "Overview report"
And I should see "4.00 (100.00 %)" in the "overview-grade" "table"
@javascript
Scenario: Natural aggregation
And I set the following settings for grade item "Sub category 1":