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

Can't delete Questions from Question bank

    XMLWordPrintable

Details

    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • MDL-74299-311
    • MDL-74299-master
    • Hide

      WARNING: We will be doing some database manipulation to setup the issue observed, which will break the quizzes in the course used. Use a new course, or better yet, a Moodle install you can just nuke when done.

      1. Create a new course
      2. Note the id of the course
      3. Create a quiz and add a question to it
      4. Run the following SQL, but replace COURSEID with the id you noted above
        3.11:

        UPDATE mdl_quiz_slots qs 
           SET questionid = 0
         WHERE qs.quizid IN (
            SELECT id FROM mdl_quiz q
             WHERE q.course = COURSEID)
        

        4.0:

        UPDATE mdl_question_versions
           SET questionid = 0
         WHERE id IN (
             SELECT qv.id FROM mdl_quiz q
              JOIN mdl_quiz_slots qs ON qs.quizid = q.id
              JOIN mdl_question_references qr ON qr.itemid = qs.id
              JOIN mdl_question_bank_entries qbe ON qbe.id = qr.questionbankentryid
              JOIN mdl_question_versions qv ON qv.questionbankentryid = qbe.id 
             WHERE q.course = COURSEID
         )
        

      5. Now back in Moodle, in any course, create a question in the question bank
      6. Attempt to delete it
      7. Confirm the question has been deleted
      Show
      WARNING: We will be doing some database manipulation to setup the issue observed, which will break the quizzes in the course used. Use a new course, or better yet, a Moodle install you can just nuke when done. Create a new course Note the id of the course Create a quiz and add a question to it Run the following SQL, but replace COURSEID with the id you noted above 3.11: UPDATE mdl_quiz_slots qs SET questionid = 0 WHERE qs.quizid IN ( SELECT id FROM mdl_quiz q WHERE q.course = COURSEID) 4.0: UPDATE mdl_question_versions SET questionid = 0 WHERE id IN ( SELECT qv.id FROM mdl_quiz q JOIN mdl_quiz_slots qs ON qs.quizid = q.id JOIN mdl_question_references qr ON qr.itemid = qs.id JOIN mdl_question_bank_entries qbe ON qbe.id = qr.questionbankentryid JOIN mdl_question_versions qv ON qv.questionbankentryid = qbe.id WHERE q.course = COURSEID ) Now back in Moodle, in any course, create a question in the question bank Attempt to delete it Confirm the question has been deleted

    Description

      We are unable to delete questions from the question bank.  The warning popup appears.  If the question was used somewhere it has an asterisk in front of the title.  Either way we confirm the delete and nothing changes.  The quest does not delete.  I recreated the issue by making a new question and immediately trying to delete it.  I haven't found any reason for this via the UI.  I'm just beginning the debug process and will report what I find.

      Attachments

        Issue Links

          Activity

            People

              emerrill Eric Merrill
              swit Matthew G. Switlik
              Tim Hunt Tim Hunt
              Andrew Lyons Andrew Lyons
              Gladys Basiana Gladys Basiana
              Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/May/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 50 minutes
                  50m