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

Unexpected changes on grades after upgrade to Moodle 2.8

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Pre-requisites

      1. You will need a course with two users, A and B.
      2. Configure the course grade total to display as ‘Real (Percent)’.
      3. Configure the course category to use 'Sum of grades'
      4. Go into your gradebook and create a new manual Grade Item, leave it at the default 100 points and change the display to 'Real (Percent)’.
      5. Give User A a grade of '10' and save.
      6. You should see the user has a grade of '10 (10%)'.
      7. Edit the grade item and set the maximum points to 10.
      8. Go back to the gradebook and give User B a grade of 10 and save.
      9. Add a series of grade items, categories, max grades, extra credit, use different aggregation methods, calculated grade items, outcomes, quiz module, workshop module (more than 1 grade item) ...
      10. Grade somes students
      11. Make changes to min/max grade of the items
      12. Snapshot your gradebook to compare it later

      Upgrading from 2.7

      1. Check verify that both users A and B show ’10 (100%)’ for both the grade item and course totals.
      2. Run the upgrade step.
      3. Confirm there were no errors during upgrade.
      4. Check verify that the grades of the users have not changed.
      5. Ensure that no warning is displayed in the gradebook.

      Upgrading from 2.8, 2.9, master

      1. You will now see that User A has a grade of '10 (10%)' while User B has a grade of '10 (100%)’, for both the item and the course total.
      2. Run the upgrade step.
      3. Confirm there were no errors during upgrade.
      4. Check verify that the grades of the users have not changed.
      5. Ensure that a warning is displayed in the gradebook.
      Show
      Pre-requisites You will need a course with two users, A and B. Configure the course grade total to display as ‘Real (Percent)’. Configure the course category to use 'Sum of grades' Go into your gradebook and create a new manual Grade Item, leave it at the default 100 points and change the display to 'Real (Percent)’. Give User A a grade of '10' and save. You should see the user has a grade of '10 (10%)'. Edit the grade item and set the maximum points to 10. Go back to the gradebook and give User B a grade of 10 and save. Add a series of grade items, categories, max grades, extra credit, use different aggregation methods, calculated grade items, outcomes, quiz module, workshop module (more than 1 grade item) ... Grade somes students Make changes to min/max grade of the items Snapshot your gradebook to compare it later Upgrading from 2.7 Check verify that both users A and B show ’10 (100%)’ for both the grade item and course totals. Run the upgrade step. Confirm there were no errors during upgrade. Check verify that the grades of the users have not changed. Ensure that no warning is displayed in the gradebook. Upgrading from 2.8, 2.9, master You will now see that User A has a grade of '10 (10%)' while User B has a grade of '10 (100%)’, for both the item and the course total. Run the upgrade step. Confirm there were no errors during upgrade. Check verify that the grades of the users have not changed. Ensure that a warning is displayed in the gradebook.
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48618-master
    • Sprint:
      Team '; drop tables Sprint 7

      Description

      Quick summary

      If a grade item of has its max points changed after someone receives a grade, then the resulting computed grade becomes very different from previous version of Moodle.

      Steps to reproduce

      You can recreate the problem in 2.8 without the upgrade step.

      1. You will need a course with two users, A and B.
      2. Go into your gradebook and create a new manual Grade Item, leave it at the default 100 points and change the display to 'Real (Percent)'
      3. Give User A a grade of '10' and save.
      4. You should see the user has a grade of '10 (10%)'.
      5. Edit the grade item and set the maximum points to 10.
      6. Go back to the gradebook and give User B a grade of 10 and save.
      7. You will now see that User A has a grade of '10 (10%)' while User B has a grade of '10 (100%)'
        • If you did this under 2.7, both users would have '10 (100%)', but then when you upgrade the site to 2.8, the grades would change to how you see them in the above example.

      Background/Cause

      When a grade is entered for a user, it is recorded in the grade_grade table. We record various bits of data, include the then current maxgrade of the grade_item, but under rawgrademax. In versions of Moodle prior to 2.8, when making derivative computations off the grade, we would always fetch grade_item->maxgrade, which contains the now max grade for the grade_item, and use that as the number of available points.

      After the gradebook changes, grade_grade->rawgrademax is now used for the computation, in large part to support the computation of grades for different users with different sets of hidden grades. This has lead to a number of side effects:

      • Percents and any downstream computed grades (and number of points available) have changed for grade entries that have this problem.
      • Two users with the same number of points for an item can see different percents.
      • Drop lowest/keep highest selections are wrong.
      • If you have the Range rows on in the gradebook, it will show the 'expanded' range. So in our above example it will show 0-100, even though 10 is the max points.
      • In the user report the user will see the expanded range.

      How do users cause it

      The most common thing we see is that teachers create a grade item for something, and forget to change the max points to what they want (usually 4 points). They then go and grade people. Then they see the mistake and change the max grade to be 4, with their intent (and the previous behavior being) that a user with a grade of 4 points has a 100%.

      How wide spread

      I've written a reporting and fixing tool that I will attach to this, but I ran some reports on our system and found that it effects 10-15% of all enrollments in our system, and about 5% of all grade_grade entries.

      Possible routes to a solution?

      1. Go back to the old way of computing grade_grade values. MDL-47078 and MDL-47059 are where these changes were made.
      2. Decide that the new way is the right way, which means a few things need to be done:
        1. Upgrade steps to 'fixup' the old rawgrademax values.
          • Is it ok to just copy grade_item->maxgrade over to grade_grade->rawgrademax when they don't match (only for non course or category item types) and then make it all as needing regrading?
        2. Restore steps to fix restores
        3. Figuring out how to stop it from happening in the future. When they change a grade item, what do they mean? We may need to add UI to get the user to choose between these:
          1. I want to keep the point value and just change the 'out of' for everybody. (Old behavior)
          2. I want to keep the same equivalent %, scaled to the new max.
          3. I want to keep the points and max as they were for all entered grade. (Current behavior, and this seems the least useful from a user standpoint to me)
        4. Review each module with grades and make sure they behave correctly (mod_assign is particularly fun in this regard...)

      Original chat between Eric and Eloy: https://moodle.org/local/chatlogs/index.php?conversationid=16933

        Attachments

        1. fix_rawgrademax_grades.php
          14 kB
          Eric Merrill

          Issue Links

            Activity

              People

              • Votes:
                96 Vote for this issue
                Watchers:
                114 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  6/Jul/15