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

Improve Missing Question Type handling in Question Bank

XMLWordPrintable

    • MOODLE_500_STABLE
    • MOODLE_500_STABLE
    • Hide

      Question Usage

       

      SELECT id, qtype FROM {question}
      WHERE qtype NOT IN (   SELECT DISTINCT SUBSTRING(plugin, 7)    FROM {config_plugins}
         WHERE plugin LIKE 'qtype%')
      

       

      Show
      Question Usage   SELECT id, qtype FROM {question} WHERE qtype NOT IN ( SELECT DISTINCT SUBSTRING(plugin, 7 ) FROM {config_plugins} WHERE plugin LIKE 'qtype%' )  
    • Hide

      Setup

      1. Check out the previous weekly release main branch for comparisons
      2. Install a new question type we can use for testing. I chose to use (https://github.com/marcusgreen/moodle-qtype_wordselect) but any other question type will do.
      3. Create a question bank on a course or quiz
      4. Create 2 questions of the that type, e.g. "wordselect" and 1 question of any other type
      5. Remove the "wordselect" question type by deleting the question/type/wordselect directory (or whichever one you chose to install)
      6. Check the questions in the question bank and confirm they have the little question mark icon to indicate they are of a missing type
      7. Pick one of the 2 questions in the question bank and click the link in the comments icon - confirm it throws an error
      8. Now click the link in the usage column - confirm it throws an error
      9. Now check the box for that question and in the "With selected" dropdown at the bottom, try to move it to another question bank - confirm it throws an error (Might need to create another question bank if you don't have any others)
      10. Try to delete the question via either Edit link in the row - confirm that deletion works ok

       

      Testing Steps

      1. Checkout the latest main branch and purge caches
      2. Check the questions in the question bank and confirm that the "wordselect" question is now highlighted red with a label making it clear that it's an invalid type
      3. Confirm clicking on the number in the usage column opens the usual dialougue, but with no preview of the question, just a message that it cannot be previewed.
      4. Confirm that you can still delete the question via it's Edit menu

       

       

      Show
      Setup Check out the previous weekly release main branch for comparisons Install a new question type we can use for testing. I chose to use ( https://github.com/marcusgreen/moodle-qtype_wordselect) but any other question type will do. Create a question bank on a course or quiz Create 2 questions of the that type, e.g. "wordselect" and 1 question of any other type Remove the "wordselect" question type by deleting the question/type/wordselect directory (or whichever one you chose to install) Check the questions in the question bank and confirm they have the little question mark icon to indicate they are of a missing type Pick one of the 2 questions in the question bank and click the link in the comments icon - confirm it throws an error Now click the link in the usage column - confirm it throws an error Now check the box for that question and in the "With selected" dropdown at the bottom, try to move it to another question bank - confirm it throws an error (Might need to create another question bank if you don't have any others) Try to delete the question via either Edit link in the row - confirm that deletion works ok   Testing Steps Checkout the latest main branch and purge caches Check the questions in the question bank and confirm that the "wordselect" question is now highlighted red with a label making it clear that it's an invalid type Confirm clicking on the number in the usage column opens the usual dialougue, but with no preview of the question, just a message that it cannot be previewed. Confirm that you can still delete the question via it's Edit menu    
    • Hide

      Code verified against automated checks.

      Checked MDL-84247 using repository: https://github.com/timhunt/moodle.git

      More information about this report

      Built on: Mon Mar 17 17:56:38 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-84247 using repository: https://github.com/timhunt/moodle.git main (0 errors / 0 warnings) [branch: MDL-84247 | CI Job ] More information about this report Built on: Mon Mar 17 17:56:38 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-84247 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18628/ PHPUnit (sqlsrv / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63789/ Behat (NonJS - boost and classic / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63790/ Behat (Firefox - boost / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63791/ Behat (Firefox - classic / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63792/ App tests (stable app version) / complete) Built on: Mon Mar 17 17:51:25 UTC 2025

      Question Bank

      Invalid questions in the question bank should:

      1. Still be displayed, but be clearer that they are invalid
      2. Be able to be deleted
      3. The "comments" popup needs to not error when opened for a question of a missing type.
      4. The "usage" popup needs to not error when opened for a question of a missing type.

        1. Comment-popup-after-changes.png
          39 kB
          Tim Hunt
        2. MDL-84247-2.png
          619 kB
          Ron Carl Alfon Yu
        3. MDL-84247.png
          798 kB
          Ron Carl Alfon Yu

            cwarwicker CMR
            tkorner Thomas Korner
            Mark Johnson Mark Johnson
            Tim Hunt Tim Hunt
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 36 minutes
                5h 36m

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