Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
9784aa23
Commit
9784aa23
authored
Jun 05, 2015
by
Adrian Greeve
Browse files
MDL-30315 gradebook: Uploading feedback doesn't override grades.
parent
7da2ed7a
Changes
6
Hide whitespace changes
Inline
Side-by-side
grade/import/csv/classes/load_data.php
View file @
9784aa23
...
...
@@ -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
))
{
...
...
grade/import/csv/tests/load_data_test.php
View file @
9784aa23
...
...
@@ -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
);
...
...
grade/import/lib.php
View file @
9784aa23
...
...
@@ -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
;
...
...
lib/db/install.xml
View file @
9784aa23
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB
PATH=
"lib/db"
VERSION=
"201
41017
"
COMMENT=
"XMLDB file for core Moodle tables"
<XMLDB
PATH=
"lib/db"
VERSION=
"201
50811
"
COMMENT=
"XMLDB file for core Moodle tables"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"../../lib/xmldb/xmldb.xsd"
>
...
...
@@ -1951,6 +1951,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"
/>
...
...
lib/db/upgrade.php
View file @
9784aa23
...
...
@@ -4136,5 +4136,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint
(
true
,
2014111006.10
);
}
if
(
$oldversion
<
2014111007.07
)
{
// 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
,
2014111007.07
);
}
return
true
;
}
version.php
View file @
9784aa23
...
...
@@ -29,7 +29,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$version
=
2014111007.0
6
;
// 20141110 = branching date YYYYMMDD - do not modify!
$version
=
2014111007.0
7
;
// 20141110 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment