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

grade_item->refresh_grades doesn't propagate $userid

XMLWordPrintable

    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MDL-36061_userid
    • Hide

      Check the unit tests run successfully. Run "phpunit grade_item_testcase lib/grade/tests/grade_item_test.php" if you want to run them yourself.

      To test this you'll need an assignment that a student has a grade for. Create an assignment, have the student submit something and then mark them if you dont already have one. Make a note of the grade.

      In the gradebook on the grader report override the student grade.

      Click the edit icon next to the overriden grade. Clear the "Overridden" checkbox and Save.

      Check you dont receive any errors. The student's grade should have gone back to what it was originally.

      Show
      Check the unit tests run successfully. Run "phpunit grade_item_testcase lib/grade/tests/grade_item_test.php" if you want to run them yourself. To test this you'll need an assignment that a student has a grade for. Create an assignment, have the student submit something and then mark them if you dont already have one. Make a note of the grade. In the gradebook on the grader report override the student grade. Click the edit icon next to the overriden grade. Clear the "Overridden" checkbox and Save. Check you dont receive any errors. The student's grade should have gone back to what it was originally.

      The refresh_grades function takes as an optional userid parameter, which it then proceeds to do absolutely nothing with. Looking at the code, there is a call to grade_update_mod_grades, which also can take an optional userid parameter, only we aren't passing it in. By not passing in this value, we are causing unnecessary work to be done in certain cases (like when a single grade has it's override flag removed) by forcing ALL grades to be refreshed instead of just the one we care about.

      The following (from http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/grade/grade_item.php;h=12afe84e3930b769c3cd19829cc3e79c41604493;hb=HEAD)

      lib/grade/grade_item.php

      1448: grade_update_mod_grades($activity)

      should be replaced with this

      lib/grade/grade_item.php

      1448: grade_update_mod_grades($activity,$userid)

            andyjdavis Andrew Davis
            jmlsteele Jody Steele
            Rajesh Taneja Rajesh Taneja
            Dan Poltawski Dan Poltawski
            Frédéric Massart Frédéric Massart
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.