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

Removing a grade override on an assignment (2.3) grade creates a mdl_grade_grades row for all users in mdl_user for that grade item

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.3.3
    • Component/s: Assignment, Gradebook
    • Labels:
      None
    • Testing Instructions:
      Hide
      • Create a new course
      • Enrol 1 user in the course
      • Create an assignment in the course
      • View the course gradebook
      • Edit the grade for the user in the assignment - (do not make any changes - leave "overridden" off but save the form).
      • Run this SQL

        select count(*) from mdl_grade_grades where itemid in (select MAX(id) from mdl_grade_items);

      • The answer should be 1
      Show
      Create a new course Enrol 1 user in the course Create an assignment in the course View the course gradebook Edit the grade for the user in the assignment - (do not make any changes - leave "overridden" off but save the form). Run this SQL select count(*) from mdl_grade_grades where itemid in (select MAX(id) from mdl_grade_items); The answer should be 1
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      Removing grade override on an assignment (2.3) grade creates a row in mdl_grade_grades for all users in mdl_user table for that grade item. This is causing performance problems on sites with a large number of users. For sites with a large number of users this will cause the script to run out of memory and never completely finish.

      To reproduce:
      1. Run this query to see how many mdl_grade_grades the guest user has:
      SELECT COUNT FROM mdl_grade_grades WHERE userid = 1 LIMIT 1;
      2. Create a course.
      3. Add an assignment (2.3 not older 2.2)
      4. Add 1 user as a student to course, but not guest user.
      5. Turn on editing in gradebook and type a grade in the assignment and update.
      6. Edit the grade and uncheck the "Overridden" check box and save changes. For sites with a large number of users this will cause the script to run out of memory.
      7. Run this query to see how many mdl_grade_grades the guest user has:
      SELECT COUNT FROM mdl_grade_grades WHERE userid = 1 LIMIT 1;
      You will see that count has increased.

      Running
      SELECT userid, COUNT FROM mdl_grade_grades WHERE itemid IN (SELECT itemid FROM mdl_grade_grades WHERE userid = 1) GROUP BY userid ORDER BY userid LIMIT 30;
      will help convince you that it is creating rows for all users for that itemid.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  11 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Nov/12