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

Changing Question Status to Draft from the Question Bank page can break Question Bank and Quizzes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • 4.0.2, 4.1
    • Questions
    • None
    • MOODLE_400_STABLE, MOODLE_401_STABLE

      If you change the status of a question from the Question Bank screen to Draft, it can break  the Question Bank page, the Quiz attempts/preview if already included in a quiz, and the Questions page of quiz if the question is already included. If you edit the question and edit the status there, it doesn't seem to have the same effect. The exact error seems to vary by question type. I don't use the term break lightly. For example changing the status of the true/false question "Moodle acronym" in the "Default for New Features" category in the Activities examples course on the Moodle QA site:
      https://qa.moodledemo.net/question/edit.php?courseid=2&cat=2%2C25&recurse=1&showhidden=0&qbshowtext=0
      causes the error to show in earlier questions in that category. It is inconsistent which one. The actual true/false question doesn't show, so I'm not sure how a user without database access could fix this issue. The error message for this one is:

      Warning: Undefined array key "s22" in /opt/app/mod/quiz/report/statistics/report.php on line 849Exception - Attempt to assign property "maxmark" on nullMore information about this error
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:    line 850 of /mod/quiz/report/statistics/report.php: Error thrown
          line 83 of /question/bank/statistics/classes/helper.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
          line 105 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats()
          line 134 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::load_question_stats_item()
          line 180 of /question/bank/statistics/classes/helper.php: call to qbank_statistics\helper::calculate_average_question_stats_item()
          line 63 of /question/bank/statistics/classes/columns/discrimination_index.php: call to qbank_statistics\helper::calculate_average_question_discrimination_index()
          line 220 of /question/classes/local/bank/column_base.php: call to qbank_statistics\columns\discrimination_index->display_content()
          line 1205 of /question/classes/local/bank/view.php: call to core_question\local\bank\column_base->display()
          line 1125 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table_row()
          line 1101 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->print_table()
          line 992 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_questions()
          line 761 of /question/classes/local/bank/view.php: call to core_question\local\bank\view->display_question_list()
          line 60 of /question/edit.php: call to core_question\local\bank\view->display()

      I will add an image of this example.

      Often the error messages are inaccurate. For instance previewing a quiz in Moodle 4.0.2 with a question in draft state from the Question Bank gives this error:
      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.
      More information about this error    Debug info: 
      Error code: codingerror
              Stack trace:     line 85 of /question/type/missingtype/question.php: coding_exception thrown
          line 364 of /question/behaviour/behaviourbase.php: call to qtype_missingtype_question->start_attempt()
          line 149 of /question/behaviour/interactive/behaviour.php: call to question_behaviour->init_first_step()
          line 1064 of /question/engine/questionattempt.php: call to qbehaviour_interactive->init_first_step()
          line 582 of /question/engine/questionusage.php: call to question_attempt->start()
          line 257 of /mod/quiz/locallib.php: call to question_usage_by_activity->start_all_questions()
          line 2685 of /mod/quiz/locallib.php: call to quiz_start_new_attempt()
          line 113 of /mod/quiz/startattempt.php: call to quiz_prepare_and_start_new_attempt()

       

      Viewing the Questions page of a quiz with a question with status set to draft in the Question Bank in Moodle 4.0.2
      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 More information about this error Debug info: Error code: generalexceptionmessage Stack trace:}}

      • line 46 of /mod/quiz/classes/question/bank/qbank_helper.php: TypeError thrown
      • line 680 of /mod/quiz/classes/structure.php: call to mod_quiz\question\bank\qbank_helper::get_version_options()
      • line 759 of /mod/quiz/classes/output/edit_renderer.php: call to mod_quiz\structure->get_version_choices_for_slot()
      • line 537 of /mod/quiz/classes/output/edit_renderer.php: call to mod_quiz\output\edit_renderer->question()
      • line 510 of /mod/quiz/classes/output/edit_renderer.php: call to mod_quiz\output\edit_renderer->question_row()
      • line 93 of /mod/quiz/classes/output/edit_renderer.php: call to mod_quiz\output\edit_renderer->questions_in_section()
      • line 211 of /mod/quiz/edit.php: call to mod_quiz\output\edit_renderer->edit_page()

       

       

            Unassigned Unassigned
            mspall Michael Spall
            Votes:
            15 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

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