mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-30315 gradebook: Uploading feedback doesn't override grades.
This commit is contained in:
parent
dda862abb5
commit
0305798c62
@ -577,6 +577,7 @@ class gradeimport_csv_load_data {
|
||||
|
||||
} else {
|
||||
// The grade item for this is not updated.
|
||||
$newfeedback->importonlyfeedback = true;
|
||||
$insertid = self::insert_grade_record($newfeedback, $this->studentid);
|
||||
// Check to see if the insert was successful.
|
||||
if (empty($insertid)) {
|
||||
|
@ -210,6 +210,7 @@ Bobby,Bunce,,"Moodle HQ","Rock on!",student5@example.com,75.00,,75.00,{exportdat
|
||||
$testarray[$key]->feedback = $record->feedback;
|
||||
$testarray[$key]->importcode = $testobject->get_importcode();
|
||||
$testarray[$key]->importer = $USER->id;
|
||||
$testarray[$key]->importonlyfeedback = 0;
|
||||
|
||||
// Check that the record was inserted into the database.
|
||||
$this->assertEquals($gradeimportvalues, $testarray);
|
||||
|
@ -114,6 +114,10 @@ function grade_import_commit($courseid, $importcode, $importfeedback=true, $verb
|
||||
if (!$importfeedback) {
|
||||
$grade->feedback = false; // ignore it
|
||||
}
|
||||
if ($grade->importonlyfeedback) {
|
||||
// False means do not change. See grade_itme::update_final_grade().
|
||||
$grade->finalgrade = false;
|
||||
}
|
||||
if (!$gradeitem->update_final_grade($grade->userid, $grade->finalgrade, 'import', $grade->feedback)) {
|
||||
$errordata = new stdClass();
|
||||
$errordata->itemname = $gradeitem->itemname;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20150306" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20150608" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -1941,6 +1941,7 @@
|
||||
<FIELD NAME="feedback" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="importcode" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="similar to backup_code, a unique batch code for identifying one batch of imports"/>
|
||||
<FIELD NAME="importer" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="importonlyfeedback" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
|
@ -4441,5 +4441,20 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015062500.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015081300.01) {
|
||||
|
||||
// Define field importtype to be added to grade_import_values.
|
||||
$table = new xmldb_table('grade_import_values');
|
||||
$field = new xmldb_field('importonlyfeedback', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'importer');
|
||||
|
||||
// Conditionally launch add field importtype.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015081300.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015081300.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015081300.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user