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

Better handling of broken (needsupdate = 1) gradebook


    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 3.5.2, 3.6, 3.7, 3.11.11
    • Gradebook

      This is a followup of MDL-64609, where it was detected that is extremely easy to end with a broken gradebook.

      Reproduction steps:

      1. Go into a course (can be new) with at least one student
      2. Create any grade-able activity, give to it the "g1" idnumber (common activity settings).
      2. Go to Gradebook setup
      3. Add a category
      6. Edit the category calculation and set it to =[[g1]]
      7. Delete the activity from the course (and run adhoc tasks if needed to complete the deletion)
      8. Once deleted completely, try visiting the overview report, the user report... all them end showing an exception about gradesneedregrading. For example:

      Debug info: 
      Error code: gradesneedregrading
      $a contents:
      ×Stack trace:
      line 717 of /grade/export/lib.php: moodle_exception thrown
      line 138 of /grade/lib.php: call to export_verify_grades()
      line 432 of /grade/lib.php: call to graded_users_iterator->init()
      line 39 of /grade/report/overview/renderer.php: call to grade_get_graded_users_select()
      line 132 of /grade/report/overview/index.php: call to gradereport_overview_renderer->graded_users_selector()

      So, it's extremely easy to break the gradebook with something as simple as removing an activity or grade item that is being used in calculations. And later it's extremely hard to find which formula is the one causing the mess.

      This issue is about:

      A) If possible, avoid removing activities or grade items that are being used. Consistency.

      B) When any grade item needs update (or its formula is wrong), show it visually, so the teacher knows which one is the problematic item. Visibility.

      C) If possible, allow all those reports to work ok, no matter there are items needing update. Apply B) to those reports too.

      D) Maybe, coming from MDL-74449, build some consistency checker (and fixer) so we can see which the status of big and old gradebooks is. I think we'll fins a lot of orphaned stuff in many of them.


      PS: Only confirmed in 3.7dev, but I can imagine it's the same in stables, so adding them to the affected versions.

        1. bulk_delete_001.png
          227 kB
        2. bulk_delete_002.png
          135 kB
        3. single_delete_001.png
          219 kB
        4. single_delete_002.png
          124 kB
        5. gradebook_error_001.png
          212 kB

            Unassigned Unassigned
            stronk7 Eloy Lafuente (stronk7)
            13 Vote for this issue
            21 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.