Merge branch 'MDL-50089-master' of git://github.com/merrill-oakland/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2015-06-22 19:58:53 +02:00
2 changed files with 24 additions and 2 deletions
+18 -1
View File
@@ -237,7 +237,24 @@ abstract class grade_export {
if (is_array($this->displaytype) && !is_null($gradedisplayconst)) {
$displaytype = $gradedisplayconst;
}
return grade_format_gradevalue($grade->finalgrade, $this->grade_items[$grade->itemid], false, $displaytype, $this->decimalpoints);
$gradeitem = $this->grade_items[$grade->itemid];
// We are going to store the min and max so that we can "reset" the grade_item for later.
$grademax = $gradeitem->grademax;
$grademin = $gradeitem->grademin;
// Updating grade_item with this grade_grades min and max.
$gradeitem->grademax = $grade->get_grade_max();
$gradeitem->grademin = $grade->get_grade_min();
$formattedgrade = grade_format_gradevalue($grade->finalgrade, $gradeitem, false, $displaytype, $this->decimalpoints);
// Resetting the grade item in case it is reused.
$gradeitem->grademax = $grademax;
$gradeitem->grademin = $grademin;
return $formattedgrade;
}
/**
+6 -1
View File
@@ -19,6 +19,7 @@ Feature: I need to export grades as text
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | a1 | Test assignment name | Submit your online text | 1 |
| assign | C1 | a2 | Test assignment name 2 | Submit your online text | 1 |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
@@ -59,6 +60,8 @@ Feature: I need to export grades as text
Then I should see "Student,1"
And I should see "80.00 %"
And I should see "B-"
And I should not see "40.00 %"
And I should not see ",F,"
@javascript
Scenario: Export grades as text using real, percentages and letters
@@ -71,4 +74,6 @@ Feature: I need to export grades as text
Then I should see "Student,1"
And I should see "80.00"
And I should see "80.00 %"
And I should see "B-"
And I should see "B-"
And I should not see "40.00 %"
And I should not see ",F,"