Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43449

timecreated and timemodified in mdl_grade_grades set to null after grading submission or removing grade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.5.3, 3.1
    • Fix Version/s: None
    • Component/s: Assignment, Gradebook
    • Labels:
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_31_STABLE
    • Testing Instructions:
      Hide

      Timecreated set to null when submission is graded

      • Create a test user
      • Create a course
      • Enrol the user into the course
      • Created an assignment
      • Login as the student and add a submission
      • Notice the grade_grades timecreated field is set
      • Login as an admin and give the student a grade
      • Notice the grade_grades timecreted field is set to null but the timemodified field is set.

      Timemodified set to null when grade is removed from assignment grading interface

      • Create a test user
      • Create a course
      • Enrol the user into the course
      • Created an assignment
      • Go into the assignment and give the student a grade
      • Notice the mdl_grade_grades timemodified values is set
      • Go back into the assignment and remove the grade from the grading textfield
      • Notice the mld_grade_grades timemodified value is set to null
      Show
      Timecreated set to null when submission is graded Create a test user Create a course Enrol the user into the course Created an assignment Login as the student and add a submission Notice the grade_grades timecreated field is set Login as an admin and give the student a grade Notice the grade_grades timecreted field is set to null but the timemodified field is set. Timemodified set to null when grade is removed from assignment grading interface Create a test user Create a course Enrol the user into the course Created an assignment Go into the assignment and give the student a grade Notice the mdl_grade_grades timemodified values is set Go back into the assignment and remove the grade from the grading textfield Notice the mld_grade_grades timemodified value is set to null

      Description

      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.


      Similar to timecreated, the timemodified field in mld_grade_grades gets set to null given the following steps:

      • Create a test user
      • Create a course
      • Enrol the user into the course
      • Created an assignment
      • Go into the assignment and give the student a grade
      • Notice the mdl_grade_grades timemodified values is set
      • Go back into the assignment and remove the grade from the grading textfield
      • Notice the mld_grade_grades timemodified value is set to null

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              adelamarre Akin Delamarre
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: