MDL-44447 grade_export: Added multiple grade display types to grade export.

This commit is contained in:
Simey Lameze 2014-08-22 10:50:08 +08:00
parent 482abd0f70
commit be289f57b2
17 changed files with 150 additions and 47 deletions

View file

@ -41,7 +41,8 @@ if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('
$params = array(
'includeseparator'=>true,
'publishing' => true,
'simpleui' => true
'simpleui' => true,
'multipledisplaytypes' => true
);
$mform = new grade_export_form(null, $params);
$data = $mform->get_data();

View file

@ -67,9 +67,11 @@ class grade_export_txt extends grade_export {
$exporttitle[] = get_string("suspended");
}
// Add a feedback column.
// Add grades and feedback columns.
foreach ($this->columns as $grade_item) {
$exporttitle[] = $this->format_column_name($grade_item);
foreach ($this->displaytype as $gradedisplayname => $gradedisplayconst) {
$exporttitle[] = $this->format_column_name($grade_item, false, $gradedisplayname);
}
if ($this->export_feedback) {
$exporttitle[] = $this->format_column_name($grade_item, true);
}
@ -100,7 +102,9 @@ class grade_export_txt extends grade_export {
$status = $geub->track($grade);
}
$exportdata[] = $this->format_grade($grade);
foreach ($this->displaytype as $gradedisplayconst) {
$exportdata[] = $this->format_grade($grade, $gradedisplayconst);
}
if ($this->export_feedback) {
$exportdata[] = $this->format_feedback($userdata->feedbacks[$itemid]);

View file

@ -44,7 +44,8 @@ $actionurl = new moodle_url('/grade/export/txt/export.php');
$formoptions = array(
'includeseparator'=>true,
'publishing' => true,
'simpleui' => true
'simpleui' => true,
'multipledisplaytypes' => true
);
$mform = new grade_export_form($actionurl, $formoptions);

View file

@ -39,11 +39,36 @@ Feature: I need to export grades as text
And I should not see "80.00"
@javascript
Scenario: Export grades as text using percentages
Scenario: Export grades as text using real
When I set the field "Grade report" to "Plain text file"
And I expand all fieldsets
And I set the field "Grade export display type" to "Percent"
And I set the following fields to these values:
| Real | 1 |
And I click on "Course total" "checkbox"
And I press "Download"
Then I should see "Student,1"
And I should see "80.00"
@javascript
Scenario: Export grades as text using percentages and letters
When I set the field "Grade report" to "Plain text file"
And I set the following fields to these values:
| Percentage | 1 |
| Letter | 1 |
And I press "Download"
Then I should see "Student,1"
And I should see "80.00 %"
And I should see "B-"
@javascript
Scenario: Export grades as text using real, percentages and letters
When I set the field "Grade report" to "Plain text file"
And I set the following fields to these values:
| Real | 1 |
| Percentage | 1 |
| Letter | 1 |
And I press "Download"
Then I should see "Student,1"
And I should see "80.00"
And I should see "80.00 %"
And I should see "B-"