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

Notes for deleted courses causes error

    Details

    • Testing Instructions:
      Hide

      This test requires making changes before running upgrade
      This test needs all databases for testing

      Test 1 (After upgrade)

      1. Enable user notes on your site.
      2. Browse your list of users for a user that is enrolled in a course.
      3. In the navigation menu, under users, choose Notes.
      4. Under one of the courses, choose "Add a new note".
      5. Add a note, leaving it at the course context and save.
      6. Delete the course you added the note for.
      7. Go back to the user's note page, make sure no error is presented.
      8. Make sure the note is deleted from database (table 'post').

      Test 2 (Before upgrade)

      1. Please repeat this step for all supported databases atleast in master.
      2. To test if upgrade is working properly we need to make some changes in database. Create a few course level notes (same process as in test 1) and go to database and edit the courseid field for those notes (located in table 'post') and change it to a non-existent courseid.
      3. Run the upgrade.
      4. Visit the notes page user and make sure no error is shown.
      5. Go to the database and make sure those corrupt notes are deleted.

      Test 3 (Master only)
      Run phpunit lib/tests/moodlelib_test.php and make sure it passes

      Show
      This test requires making changes before running upgrade This test needs all databases for testing Test 1 (After upgrade) Enable user notes on your site. Browse your list of users for a user that is enrolled in a course. In the navigation menu, under users, choose Notes. Under one of the courses, choose "Add a new note". Add a note, leaving it at the course context and save. Delete the course you added the note for. Go back to the user's note page, make sure no error is presented. Make sure the note is deleted from database (table 'post'). Test 2 (Before upgrade) Please repeat this step for all supported databases atleast in master. To test if upgrade is working properly we need to make some changes in database. Create a few course level notes (same process as in test 1) and go to database and edit the courseid field for those notes (located in table 'post') and change it to a non-existent courseid. Run the upgrade. Visit the notes page user and make sure no error is shown. Go to the database and make sure those corrupt notes are deleted. Test 3 (Master only) Run phpunit lib/tests/moodlelib_test.php and make sure it passes
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-42767-master
    • Story Points (Obsolete):
      13
    • Sprint:
      BACKEND Sprint 7

      Description

      When a note is added for a user at the course level on the user's notes page and then that course is deleted, an error results on the note's page that the deleted course can not be found.

      Steps to replicate ->

      Enable user notes on your site.
      Browse your list of users for a user that is enrolled in a class.
      In the navigation menu, under users, choose Notes.
      Under one of the courses, choose "Add a new note".
      Add a note, leaving it at the course context and save.
      Delete the course you added the note for.
      Go back to the user's note page:

      Can not find data record in database table course.

      More information about this error
      Debug info: SELECT * FROM

      {course}

      WHERE id = ?
      [array (
      0 => 42,
      )]
      Error code: invalidrecord
      Stack trace:

      line 1372 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1348 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 42 of /notes/index.php: call to moodle_database->get_record()

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Jan/14