MDL-46846 Grades export: Some settings were not parsed from the form correctly.

This was a regression from MDL-46548.

I also added to the behat test to cover this, and sped up the behat test while I was there.

I also restored the behaviour where usercustomfields was hardcoded to true for all
export types except XML - but the default was false.
This commit is contained in:
Damyon Wiese 2014-08-15 13:51:46 +08:00
parent e1eb180806
commit 924cb72b4a
5 changed files with 49 additions and 17 deletions

View File

@ -182,6 +182,13 @@ abstract class grade_export {
$this->previewrows = $formdata->previewrows;
}
if (isset($formdata->display)) {
$this->displaytype = $formdata->display;
}
if (isset($formdata->updatedgradesonly)) {
$this->updatedgradesonly = $formdata->updatedgradesonly;
}
}
/**

View File

@ -21,6 +21,19 @@ class grade_export_ods extends grade_export {
public $plugin = 'ods';
/**
* Constructor should set up all the private variables ready to be pulled
* @param object $course
* @param int $groupid id of selected group, 0 means all
* @param stdClass $formdata The validated data from the grade export form.
*/
public function __construct($course, $groupid, $formdata) {
parent::__construct($course, $groupid, $formdata);
// Overrides.
$this->usercustomfields = true;
}
/**
* To be implemented by child classes
*/

View File

@ -33,6 +33,9 @@ class grade_export_txt extends grade_export {
public function __construct($course, $groupid, $formdata) {
parent::__construct($course, $groupid, $formdata);
$this->separator = $formdata->separator;
// Overrides.
$this->usercustomfields = true;
}
public function get_export_params() {

View File

@ -16,23 +16,9 @@ Feature: I need to export grades as text
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission |
And I press "Save changes"
Then I should see "Submitted for grading"
And I log out
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | a1 | Test assignment name | Submit your online text | 1 |
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Grades"
@ -51,3 +37,13 @@ Feature: I need to export grades as text
And I should see "80.0"
And I should not see "Course total"
And I should not see "80.00"
@javascript
Scenario: Export grades as text using percentages
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 click on "Course total" "checkbox"
And I press "Download"
Then I should see "Student,1"
And I should see "80.00 %"

View File

@ -21,6 +21,19 @@ class grade_export_xls extends grade_export {
public $plugin = 'xls';
/**
* Constructor should set up all the private variables ready to be pulled
* @param object $course
* @param int $groupid id of selected group, 0 means all
* @param stdClass $formdata The validated data from the grade export form.
*/
public function __construct($course, $groupid, $formdata) {
parent::__construct($course, $groupid, $formdata);
// Overrides.
$this->usercustomfields = true;
}
/**
* To be implemented by child classes
*/