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

Possible to get in "recalculating grades" infinite loop

    Details

    • Testing Instructions:
      Hide
      1. Create a small test course with the generator [Site administration  ► Development  ► Make test course]. This will generate 10 assignments and 100 students.
      2. Go to the gradebook for the newly generated course.
      3. In the gradebook setup [Grade administration  ► Setup  ► Gradebook setup] create a new grade item (button at the bottom).
      4. Change the newly created grade item to a calculated grade item by clicking edit > edit calculation.
      5. Add some id numbers to the assignments.
      6. Create a simple calculation such as =[[assignment01]] + [[assignment02]].
      7. Go to the grader report, turn on editing and add over 100 grades to the students. We will be deleting an assignment that was in the calculation and it is important that when it is gone that there are still over 100 grades for students in other activities.
      8. Go to the course main page (/course/view.php).
      9. Delete one of the assignments that was part of the calculation.
      10. Click on the gradebook [Course administration ► Grades].
      11. You should now see a progress bar (if you don't see a progress bar then you do not have enough grade entries).
      12. You should also see the following error -

        Probably circular reference or broken calculation formula.

      13. Click continue. You should not be stuck on the same page with the progress bar again, but instead one of the grade reports.
      Show
      Create a small test course with the generator [Site administration  ► Development  ► Make test course] . This will generate 10 assignments and 100 students. Go to the gradebook for the newly generated course. In the gradebook setup [Grade administration  ► Setup  ► Gradebook setup] create a new grade item (button at the bottom). Change the newly created grade item to a calculated grade item by clicking edit > edit calculation. Add some id numbers to the assignments. Create a simple calculation such as =[ [assignment01] ] + [ [assignment02] ] . Go to the grader report, turn on editing and add over 100 grades to the students. We will be deleting an assignment that was in the calculation and it is important that when it is gone that there are still over 100 grades for students in other activities. Go to the course main page (/course/view.php). Delete one of the assignments that was part of the calculation. Click on the gradebook [Course administration ► Grades] . You should now see a progress bar (if you don't see a progress bar then you do not have enough grade entries). You should also see the following error - Probably circular reference or broken calculation formula. Click continue. You should not be stuck on the same page with the progress bar again, but instead one of the grade reports.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull 3.1 Branch:
      wip-MDL-55707-31
    • Pull Master Branch:
      wip-MDL-55707-master
    • Sprint:
      3.2 Sprint 5

      Description

      There are a few things you need for this to happen:

      • You need to have more than 100 grade_grades in the course, that is to say there must be at least 100 grades are assigned in the course, this triggers the progress bar to display
      • You must have an invalid calculated item

      To get an invalid calculation, you need to go to something like the course category and Edit calculation.

      1. Add IDs for a number of your items, then do the calculation formula (=[[id1]]+[[id2]]).
      2. Save
      3. Delete one of the graded items that is included in your formula from the gradebook setup page (not from the formula itself), but remember, we still need over 100 grade_grades.
      4. Bask in your infinite loop glory.

      Without the progress bar, the calculation just fails, and the page will show (and on each page view it will attempt to recalculate, since the calculation never successfully finishes and clears needsupdate). But now if you hit the limit set which triggers the progress bar, on each page you will instead just be shown the progress bar, and can never get past it.

      The only workarounds involve manipulating the DB, or at least having direct knowledge of the id of the grade item with the bad calculation...

      See forums: https://moodle.org/mod/forum/discuss.php?d=336933

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Sep/16