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

Quiz and question versions: confusing errors if all versions of a question are draft

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-74452_401_STABLE
    • MDL-74452_master
    • Hide
      1. Create a truefalse question in the question bank for a course. (Question type not important.)
      2. Create a quiz, and add the truefalse question.
      3. Go to the question bank, and change the state of version 1 of the question to draft using the select list in the table (don't use Edit > Edit question as this will create a new verison).
      4. Go the to Quiz->Questions page. Below the truefalse question you should see the warning message "This question has all versions in Draft status. The quiz will not work with this question in place. Remove this question,
        or visit the question bank and set the status to Ready." (This is also covered by a behat test)
      5. Go to the main Quiz page and click "Preview Quiz"
      6. You should see the error message "The question '$questionname' has all versions in Draft status, so cannot be used. Visit the question bank and set the status to Ready." (This cannot be covered by a behat test as it a code exception).
      Show
      Create a truefalse question in the question bank for a course. (Question type not important.) Create a quiz, and add the truefalse question. Go to the question bank, and change the state of version 1 of the question to draft using the select list in the table (don't use Edit > Edit question as this will create a new verison). Go the to Quiz->Questions page. Below the truefalse question you should see the warning message "This question has all versions in Draft status. The quiz will not work with this question in place. Remove this question, or visit the question bank and set the status to Ready." (This is also covered by a behat test) Go to the main Quiz page and click "Preview Quiz" You should see the error message "The question '$questionname' has all versions in Draft status, so cannot be used. Visit the question bank and set the status to Ready." (This cannot be covered by a behat test as it a code exception).

      This was found while testing MDL-74255.

      To reproduce:

      1. Create a truefalse question in the question bank for a course. (Question type not important.)
      2. Create a quiz, and add the truefalse question.
      3. Go to the question bank, and change the state of version 1 of the question to draft.

      Actual results:

      • When you go back to Quiz -> Questions page, you get a fatal error Exception - Argument 1 passed to mod_quiz\question\bank\qbank_helper::get_version_options() must be of the type int, string given, called in [dirroot]/mod/quiz/classes/structure.php on line 680
      • If you try to Attempt or preview the quiz, you get Coding error detected, it must be fixed by a programmer: This question is of a type that is not installed on your system. No processing is possible.

      Expected result:

      • If there teacher has got their quiz into a state where it cannot work, then at least the error message should make the real cause of the problem clear, with a hit about how to recover the situation.

      (A bit like the "'The number of random questions required is more than are still available in the category!'" warning if you get the setup of random questions wrong - although that message is not brilliant.)

      Note: a question can only be added to a quiz if at least one non-draft version exists when the question is added, so hopefully it will be rare for teachers to get themselves into this state.

       

            marxjohnson Mark Johnson
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Shamim Rezaie Shamim Rezaie
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            32 Vote for this issue
            Watchers:
            30 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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