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

grade_item->refresh_grades doesn't propagate $userid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.5, 2.3.2
    • Fix Version/s: 2.2.7, 2.3.4
    • Component/s: Gradebook
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-36061_userid

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/13