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

Show regrade error message in the quiz view page

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.9.18, 3.11.11, 4.0, 4.0.5
    • 4.2
    • Gradebook
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_402_STABLE
    • MDL-72451_master
    • Hide

      Test to see the error in quiz activity page

      1. Create a S size of course with the generator [Site administration ► Development ► Make test course]. This will generate 10 assignments and 100 students.
      2. Go to the newly generated course.
      3. Create a quiz activity.
      4. Go to the gradebook.
      5. Create a new grade item (select "Setup > Gradebook setup" from the gradebook navigation menu, then click "Add grade item") named 'Test calculation item'.
      6. Edit calculation for the newly created grade item by clicking "Edit" > "Edit calculation".
      7. Add some id numbers to the assignments and quiz, like "assignment01" or "quiz01"
      8. Create a simple calculation such as "=[[assignment01]] + [[assignment02]] + [[quiz01]]".
      9. Delete one of the assignments that was part of the calculation.
      10. Complete deletion by cron if it's in progress.
      11. Go to quiz activity page.
      12. Confirm 'Probably circular reference or broken calculation formula (Item name: Test calculation item)'
      13. Reload the same page.
      14. Confirm there is no error shown in the page.
      15. Return to the "Gradebook setup" in the gradebook
      16. Edit the calculation for "Test calculation item" and remove the broken ID (looks like ##gid01##) so it reads like "=[[assignment01]] + [[quiz01]]"
      17. Delete the remaining assignment that is used in the calculation
      18. Complete deletion by cron
      19. Log out and log in as a student
      20. Visit the quiz
      21. Confirm that they do not see the error message.
      Show
      Test to see the error in quiz activity page Create a S size of course with the generator [Site administration ► Development ► Make test course] . This will generate 10 assignments and 100 students. Go to the newly generated course. Create a quiz activity. Go to the gradebook. Create a new grade item (select "Setup > Gradebook setup" from the gradebook navigation menu, then click "Add grade item") named 'Test calculation item'. Edit calculation for the newly created grade item by clicking "Edit" > "Edit calculation". Add some id numbers to the assignments and quiz, like "assignment01" or "quiz01" Create a simple calculation such as "=[ [assignment01] ] + [ [assignment02] ] + [ [quiz01] ]". Delete one of the assignments that was part of the calculation. Complete deletion by cron if it's in progress. Go to quiz activity page. Confirm 'Probably circular reference or broken calculation formula (Item name: Test calculation item)' Reload the same page. Confirm there is no error shown in the page. Return to the "Gradebook setup" in the gradebook Edit the calculation for "Test calculation item" and remove the broken ID (looks like ##gid01##) so it reads like "=[ [assignment01] ] + [ [quiz01] ]" Delete the remaining assignment that is used in the calculation Complete deletion by cron Log out and log in as a student Visit the quiz Confirm that they do not see the error message.

    Description

      We had a big performance issue in a quiz activity view page.
      After some investigation, we found there was an issue in the grade calculation formula and the regrading process kept calculating each access.
      In our case, the each calculation took more than 10 sec and many students accessed at once, so the site was overloaded.

      When calculating regrade ("grade_regrade_final_grades" function) in the grades page and the gradeing has some errors, the system show the errors in the page and set 'needsupdate = 0' to avoid further error.
      https://github.com/moodle/moodle/blob/206023c15f680b2b3b2aab4d36515337491e0edf/lib/gradelib.php#L393-L403

      But in the quiz activity view page, the system doesn't set 'needsupdate = 0' and keep calculating regrade.
      https://github.com/moodle/moodle/blob/206023c15f680b2b3b2aab4d36515337491e0edf/lib/gradelib.php#L448-L451

      We can't see any errors in the quiz activity view page, so we don't know what's going on.
      The calculation can't fix automatically, so it's better to show something error when the issue is happening.

      Attachments

        1. check_grade_calculation.php
          4 kB
        2. MDL-72451-first-load.mpr
          170 kB
        3. MDL-72451-second-load.mpr
          150 kB
        4. Step12.png
          Step12.png
          39 kB
        5. Step13.png
          Step13.png
          30 kB
        6. Step21.png
          Step21.png
          55 kB

        Issue Links

          Activity

            People

              tomotsuyuki Tomo Tsuyuki
              tomotsuyuki Tomo Tsuyuki
              Dmitrii Metelkin Dmitrii Metelkin
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Votes:
              5 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                24/Apr/23

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 34 minutes
                  1h 34m