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

Deleting a course that's been starred causes ' invalidrecord: Can't find data record in database table course.' error

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Upgrade test.

      1. Clone a fresh site, but do not install yet.
      2. For each branch, we first need to set up a failure state, based on the latest weekly, so please run the following:
        For master:

        git checkout a672f021eaf0

        For 37:

        git checkout 6a30269d98d8

        For 36:

        git checkout 7de0c0f1ad6

      3. Now, as admin, install the site
      4. Make sure debugging is set to developer.
      5. Create two courses (c1 and c2) and a user (s1)
      6. Enrol a user (s1) into c1 and c2 as a student
      7. Log out.
      8. Log in as s1
      9. view the dashboard
      10. Add the 'Starred courses' block and the 'Course overview' block if they're not already present.
      11. From the 'Course overview' block, using the ellipsis (...) menu next to the course c1, select 'Star this course'.
      12. Do the same for c2.
      13. Log out
      14. Log in as an admin
      15. From site admin -> course management, delete the course c1
      16. Log out
      17. Log in as the student s1
      18. Go to the dashboard
      19. Verify you see an error popup. This is the bug.
      20. Log out
      21. Now, checkout the relevant head to trigger the upgrade:
        For master:

        git checkout master

        For 37:

        git checkout MOODLE_37_STABLE

        For 36:

        git checkout MOODLE_36_STABLE

      22. Log in as admin and run the upgrade.
      23. Log out
      24. Log in as the student s1.
      25. Go to the dashboard
      26. Verify you see no error popup
      27. Verify you see c2 listed in the 'Starred courses' block.

      Course deletion hook test

      1. Log in as admin
      2. Create a new course c3 and enrol s1 into it as a student
      3. Log out
      4. Log in as the student s1
      5. Go to the dashboard
      6. From the 'Course overview' block, using the ellipsis (...) menu next to the course c3, select 'Star this course'.
      7. Log out
      8. Log in as admin
      9. From site admin -> course management, delete the course c3
      10. Log out
      11. Log in as the student s1
      12. Go to the dashboard
      13. Verify you see no error popup
      14. Verify you don't see the course c3 listed in the 'Starred courses' block.
      15. Verify you see c2 listed in the 'Starred courses' block.

       

      Show
      Upgrade test. Clone a fresh site, but do not install yet. For each branch, we first need to set up a failure state, based on the latest weekly, so please run the following: For master: git checkout a672f021eaf0 For 37: git checkout 6a30269d98d8 For 36: git checkout 7de0c0f1ad6 Now, as admin, install the site Make sure debugging is set to developer. Create two courses (c1 and c2) and a user (s1) Enrol a user (s1) into c1 and c2 as a student Log out. Log in as s1 view the dashboard Add the 'Starred courses' block and the 'Course overview' block if they're not already present. From the 'Course overview' block, using the ellipsis (...) menu next to the course c1, select 'Star this course'. Do the same for c2. Log out Log in as an admin From site admin -> course management, delete the course c1 Log out Log in as the student s1 Go to the dashboard Verify you see an error popup. This is the bug. Log out Now, checkout the relevant head to trigger the upgrade: For master: git checkout master For 37: git checkout MOODLE_37_STABLE For 36: git checkout MOODLE_36_STABLE Log in as admin and run the upgrade. Log out Log in as the student s1. Go to the dashboard Verify you see no error popup Verify you see c2 listed in the 'Starred courses' block. Course deletion hook test Log in as admin Create a new course c3 and enrol s1 into it as a student Log out Log in as the student s1 Go to the dashboard From the 'Course overview' block, using the ellipsis (...) menu next to the course c3, select 'Star this course'. Log out Log in as admin From site admin -> course management, delete the course c3 Log out Log in as the student s1 Go to the dashboard Verify you see no error popup Verify you don't see the course c3 listed in the 'Starred courses' block. Verify you see c2 listed in the 'Starred courses' block.  
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-66156-master

      Description

      If a user starred a course that is then deleted, it appears no cleanup is done in the 'mdl_favourite' table to remove the reference to that course.

      When an affected user views their dashboard they get a ' invalidrecord: Can't find data record in database table course.' error as the Starred courses block tries to retrieve the deleted course.

       

        Attachments

        1. MDL-66156_01.png
          118 kB
          Jennifer Bauzon
        2. MDL-66156_02.png
          69 kB
          Jennifer Bauzon
        3. starred_deleted_course.png
          23 kB
          Neil Stapleton

          Issue Links

            Activity

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 46 minutes
                  3h 46m