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

Cannot delete a course with busted grade items

XMLWordPrintable

      We have seen a few sites with databases in a weird state that prevents users from deleting their courses. All of them have a grade item that stops deletion. While we are not yet sure how the databases get in this weird state, it seems to me that busted grade_items preventing a course from being deleted in of itself might be considered a bug.

      To reproduce on a fresh install:

      1. Create a course and add a scorm activity
      2. Delete the record that shows up in the mdl_scorm table
      3. Browse to "Site administration" > "Courses" > "Manage courses and categories"
      4. Attempt to delete the course you just made
      5. You should see an invalid module id error

      This happens because the get_context method in grade_item.php makes a call to get_fast_modinfo without doing any checks to see if the instances array contains the key it is searching for:

      $cm = get_fast_modinfo($this->courseid)->instances[$this->itemmodule][$this->iteminstance];
      

            vmdef Victor Déniz Falcón
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h

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