In Moodle 2.5 I added an assignment, logged in as a student and added a submission.
I looked in mdl_grade_grades table and saw that the timecreated field had a time stamp. I initially thought timecreated was for when a record was added to the table.
I went back into the assignment as a teacher and graded the submission, when I looked at mdl_grade_grades table I saw the timecreated field changed to null and the timemodifed field had a timestamp.
I was looking through the code and noticed the following call stack:
- mod/assign/locallib.php - gradebook_item_update() calls convert_grade_for_gradebook() where datesubmitted is set to null. Lastly it calls mod/assign/lib.php - calls assign_grade_item_update(), passing the data structure where datesubmitted is null
- mod/assign/lib.php - assign_grade_Item_update() calls lib/gradelib.php - grade_update() passing the data structure where datesubmitted is null
- lib/gradelib.php - grade_update() calls lib/grade/grade_item.php - update_raw_grade() passing datesubmitted as an argument
- lib/grade/grade_item.php - update_raw_grade() sets the grade_grades instance timecreated property to datesubmitted (null). The docblock stating "$datesubmitted A timestamp of when the student's work was submitted", but it's value is set to null.
This seems like a bug but wanted to get some input on this to see if there was an undocumented reason.
I came across this because I had a teacher user giving an assignment grade for a student that never added a submission; thought the timecreated field in the mdl_grade_grades was null to denote the user never actually submitted anything. Unfortunately this is always the case no matter the scenario.