Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.8.2
-
Fix Version/s: None
-
Component/s: Assignment
-
Labels:None
-
Environment:RHEL5, PHP 5.1.6, Apache 2.2.3, Microsoft SQL Server 2005 SP2
-
Database:Microsoft SQL
-
Affected Branches:MOODLE_18_STABLE
Description
Assignment module table assignment_submissions fields data1 and data2 are defined as not allowing null values with no default defined. When quick grading, a query like this is sent to the database if going from no grade to adding a grade entry to the table:
INSERT INTO mdl_assignment_submissions ( ASSIGNMENT, USERID, TIMECREATED, TIMEMODIFIED, NUMFILES, GRADE, SUBMISSIONCOMMENT, FORMAT, TEACHER, TIMEMARKED, MAILED ) VALUES ( 108, 109, 0, 0, 0, 14, '', 0, 109, 1184945275, 0 )
Notice that data1 and data2 are not included in the insert, so the insert fails as those fields do not accept NULL values and have no default defined. The result is a blank page.
I fixed this issue by commenting out lines 594 and 595 of mod/assignment/lib.php. These lines were added, according to the comments, because the data1 and data2 fields don't need to be updated. Is there any harm in updating them? Perhaps only avoid updating them when actually performing an update instead of an insert?
Issue Links
| This issue has been marked as being related by: | ||||
| MDL-29181 | Grades Entered with Quick Grading Not Saving |
|
|
|
Well, just from a pure-db-perspective:
1) If those fields can be empty... then the NOT NULL constraint should be dropped.
2) If those fields cannot be empty... then one meaningful value must be specified (where '' isn't a meaningful calue).
So, perhaps, the best (and more correct) solution is to change them to NULLable.
Ciao