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

Missing sub-questions of multianswer questions cause exceptions in the recalculate question statistics task

    XMLWordPrintable

Details

    Description

      This is issue B described in MDL-77080. Some cloze questions (qtype_multianswer) can have missing subquestions. Those can lead to the scheduled task \quiz_statistics\task\recalculate failing. In MDL-54724 most problems around missing subquestions have been fixed, but this has been missed.

      Error in Moodle 4.1.2:

      Scheduled task failed: Fragestatistiken neu berechnen (quiz_statistics\task\recalculate),Fehler in der Kodierung gefunden, den nur Programmierer/innen korrigieren k├Ânnen: Unknown question type subquestion_replacement
      Backtrace:
      * line 319 of /question/type/multianswer/questiontype.php: call to question_bank::get_qtype()
      * line 472 of /question/classes/statistics/questions/calculator.php: call to qtype_multianswer->get_random_guess_score()
      * line 82 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\calculator->get_random_guess_score()
      * line 647 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->__construct()
      * line 950 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
      * line 108 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
      * line 259 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
      * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      In combination with the fix for MDL-75576 making it so quiz statistics are only ever calculated in cron and not "on-the-fly" anymore this issue can lead to lots of quizzes not showing any statistics anymore.

      MDL-54724 describes one way to create cloze questions with missing sub questions through normal use in an old Moodle version. Here is how you can artificially create such a question and evoke the error:

      1. Create a quiz.
      2. Add a new question of qtype_multianswer with the text from the attached file "question-text-example.txt" to it.
      3. Modify the corresponding entry in the question_multianswer table by hand to contain one additional question id in the sequence column (no question must exist for that id!)
      4. Purge the "other" cache.
      5. Take and submit the quiz as a student.
      6. Run the \quiz_statistics\task\recalculate task.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              tschroeder Tim Schroeder
              Tim Schroeder Tim Schroeder
              Andrew Lyons Andrew Lyons
              CiBoT CiBoT
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 50 minutes
                  1h 50m

                  Clockify

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