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

Question bank must be robust if question_usages are not cleaned up when a context is deleted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.1.5, 4.2.2
    • 4.1.4, 4.2.1
    • Questions

      This is really a bug in report_embedquestion, but Moodle core should be robust to bugs in plugins.

      Steps to reproduce.

      1. Install the three embedquestion plugins: https://moodle.org/plugins/filter_embedquestion, https://moodle.org/plugins/atto_embedquestion, https://moodle.org/plugins/report_embedquestion
      2. Enable the filter at Admin -> Plugins -> Filters -> Manage filters. And add the atto button to the toolbar (as it says in the plugin install instructions.)
      3. Create a test course.
      4. Create a question in the course question bank.
      5. Ensure that both the question category and the question have an idnumber set.
      6. Create a Page resource in the course. and embedded the question in the page content.
      7. Log in as student, and attempt the question in the page. (Hopefully you won't suffer from MDL-78585.)
      8. Log back in as admin.
      9. Delete the page.
      10. Go to the question bank.

      Expected result: you see the question bank.

      Actual result: fatal error "Can't find data record in database table context."

      What is going on is that when the Page was deleted, the attempts are the embedded question are not removed from the database. (This is the bit that is a bug in report_embedquestion). Then, those left over question_usages lead to the fatal error, which is the bit where Moodle core code needs to be more robust.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Mahmoud Kassaei Mahmoud Kassaei
            Ilya Tregubov Ilya Tregubov
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                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.