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

Extend 'Invalid course module ID' exception to provide the actual id when deleting a course

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • master-MDL-74993
    • Hide

      h3 Unit tests do cover the change.

      Manual testing (optional):

      1. Access Site administration > Development > Make test course admin page.
      2. Create Small course.
      3. Access the course and pick any Assignment activity.
      4. Copy its course module id from the url (eg. 571).
      5. Query its section id:

        moodle=# SELECT section FROM mdl_course_modules WHERE id = 571;
         section 
        ---------
             152
        (1 row)
        

      6. Query section sequence:

        moodle=# SELECT sequence FROM mdl_course_sections WHERE id = 152;
                      sequence               
        -------------------------------------
         571,573,574,575,589,597,605,607,617,625
        (1 row)
        

      7. Update the record and remove 571 course module from the sequence:

        UPDATE mdl_course_sections SET sequence = '573,574,575,589,597,605,607,617,625' WHERE id = 152 AND sequence = '571,573,574,575,589,597,605,607,617,625';
        

      8. Access Site administration > Course > Manage course and categories.
      9. Select the course.
      10. Delete the course.
      11. Confirm, that Invalid course module id: 571 exception is displayed.
      Show
      h3 Unit tests do cover the change. Manual testing (optional): Access Site administration > Development > Make test course admin page. Create Small course. Access the course and pick any Assignment activity. Copy its course module id from the url (eg. 571). Query its section id: moodle=# SELECT section FROM mdl_course_modules WHERE id = 571 ; section --------- 152 ( 1 row) Query section sequence: moodle=# SELECT sequence FROM mdl_course_sections WHERE id = 152 ; sequence ------------------------------------- 571 , 573 , 574 , 575 , 589 , 597 , 605 , 607 , 617 , 625 ( 1 row) Update the record and remove 571 course module from the sequence: UPDATE mdl_course_sections SET sequence = '573,574,575,589,597,605,607,617,625' WHERE id = 152 AND sequence = '571,573,574,575,589,597,605,607,617,625' ; Access Site administration > Course > Manage course and categories. Select the course. Delete the course. Confirm , that Invalid course module id: 571 exception is displayed.

      Sometimes we see Invalid course module ID exceptions in logs related to course restores or course deletions. These exceptions are not really helpful in terms of investigations of the roots. Courses might have hundreds of course modules and sometimes it might be tricky to identify the offending one.

      It would be great to log the actual id of the record, so this would help admins to understand which course module they need to looked at.

        1. ASIS.png
          79 kB
          Misha Golenkov
        2. MDL-74993 testing.png
          138 kB
          Angelia Dela Cruz
        3. TOBE.png
          79 kB
          Misha Golenkov

            mikhailgolenkov Misha Golenkov
            mikhailgolenkov Misha Golenkov
            Stevani Andolo Stevani Andolo
            Ilya Tregubov Ilya Tregubov
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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