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

Question statistics recalculation task failing on ungraded quizzes with description questions only

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.0.10
    • Questions
    • None
    • MOODLE_400_STABLE

      Scenario:

      1. Create a quiz with a single "question" added which is a description page.
      2. On the quiz questions page specify the maximum grade as zero and save changes.
      3. Attempt the quiz as the student, submit the attempt.
      4. Run the Question statistics recalculation task from the Scheduled tasks page.
      5. The log for the task will show, and indicate task failure:

       

      Execute scheduled task: Recalculate question statistics (quiz_statistics\task\recalculate)
      ... started 14:45:18. Current memory use 21.5 MB.
        'Another quiz with just an info page and default settings' (23) in course Course 2022-02-17 | 2021-06-02 (5) has most recent attempt finished at 30/08/23, 14:31:38 so re-calculating statistics for 1 attempts, start time 30/08/23, 14:45:18 ...
      Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays

      Error code: codingerror

      • line 770 of \lib\dml\moodle_database.php: coding_exception thrown
      • line 564 of \question\engine\datalib.php: call to moodle_database->get_in_or_equal()
      • line 294 of \question\classes\statistics\questions\calculator.php: call to question_engine_data_mapper->load_questions_usages_latest_steps()
      • line 96 of \question\classes\statistics\questions\calculator.php: call to core_question\statistics\questions\calculator->get_latest_steps()
      • line 660 of \mod\quiz\report\statistics\report.php: call to core_question\statistics\questions\calculator->calculate()
      • 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 257 of \lib\cronlib.php: call to quiz_statistics\task\recalculate->execute()
      • line 167 of \admin\cli\scheduled_task.php: call to cron_run_inner_scheduled_task()

       

      Tested on Moodle 4.0.10+ so far - Version 4.0.10+ (Build: 20230826). Will try to do the same with the latest 4.1 and 4.2, and refresh this ticket accordingly.

      Previously, I tested an ungraded quiz with a single multiple choice question (max-grade = 0, mark for question=0), and this was processed successfully. Could it be that "Description"s have no marks (rather than zero), and thus pass an empty field to the array, which then causes the question statistics task to fail? Such is my current hunch.

      PS. I have just performed additional tests: The problems does NOT seem to affect Moodle 4.1.5+(Build: 20230826) or 4.2.2+ (Build: 20230826), so probably the issue will be closed as Moodle 4.0.* is no longer supported. However, if there is a workaround or a cherry-picking option I could pursue to address the problem on my Moodle 4.0.* instances (which I'm stuck with until next summer), I will be grateful to know..

            timhunt Tim Hunt
            pmk Przemek Kaszubski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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