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

Quiz with only Description questions break Recalculate question statistics task

    XMLWordPrintable

Details

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-77381-MOODLE_401_STABLE
    • MDL-77381-MOODLE_402_STABLE
    • MDL-77381-master
    • Hide
      1. Create a test course.
      2. Create a quiz.
      3. Access question bank and add a Description question.
      4. Access Questions tab of the quiz.
      5. Set Maximum grade to 0 and save.
      6. Login as a student.
      7. Attempt the quiz and finish your attempt.
      8. Run the scheduled task and observe NO error:

      root@d880b06ccd4f:/var/www/40# php admin/cli/scheduled_task.php --execute='\quiz_statistics\task\recalculate'
      Execute scheduled task: Recalculate question statistics (quiz_statistics\task\recalculate)
      ... started 13:01:39. Current memory use 23.0 MB.
        'My Quiz' (1) in course MDL-77381 (2) has most recent attempt finished at 20/07/23, 12:59:28 so re-calculating statistics for 1 attempts, start time 20/07/23, 13:01:39 ...
          Calculations completed at 20/07/23, 13:01:39.
      ... used 25 dbqueries
      ... used 0.024965047836304 seconds
      Scheduled task complete: Recalculate question statistics (quiz_statistics\task\recalculate)
      

      Additionally unit tests suites are core_questions_testsuite and quiz_statistics_testsuite. Running these observe no failures.

      Show
      Create a test course. Create a quiz. Access question bank and add a Description question. Access Questions tab of the quiz. Set Maximum grade to 0 and save. Login as a student. Attempt the quiz and finish your attempt. Run the scheduled task and observe NO error: root @d880b06ccd4f :/var/www/ 40 # php admin/cli/scheduled_task.php --execute= '\quiz_statistics\task\recalculate' Execute scheduled task: Recalculate question statistics (quiz_statistics\task\recalculate) ... started 13 : 01 : 39 . Current memory use 23.0 MB.   'My Quiz' ( 1 ) in course MDL- 77381 ( 2 ) has most recent attempt finished at 20 / 07 / 23 , 12 : 59 : 28 so re-calculating statistics for 1 attempts, start time 20 / 07 / 23 , 13 : 01 : 39 ...     Calculations completed at 20 / 07 / 23 , 13 : 01 : 39 . ... used 25 dbqueries ... used 0.024965047836304 seconds Scheduled task complete: Recalculate question statistics (quiz_statistics\task\recalculate) Additionally unit tests suites are core_questions_testsuite and quiz_statistics_testsuite . Running these observe no failures.

    Description

      Steps to replicate:

      1. Create a test course.
      2. Create a quiz.
      3. Access question bank and add a Description question.
      4. Access Questions tab of the quiz.
      5. Set Maximum grade to 0 and save.
      6. Login as a student.
      7. Attempt the quiz and finish your attempt.
      8. Run the scheduled task and observe the error:

      root@01c31895db1b:/var/www/vanilla-moodle-master# php admin/cli/scheduled_task.php --execute='\quiz_statistics\task\recalculate'
      Execute scheduled task: Recalculate question statistics (quiz_statistics\task\recalculate)
      ... started 17:55:16. Current memory use 22.6 MB.
        Examining quiz 'My Quiz' (1) in course Test 1 (2) with most recent attempt at 23/02/23, 17:55:10.
          Calculating statistics for 1 attempts, starting at 23/02/23, 17:55:16 ...
      Exception - ksort(): Argument #1 ($array) must be of type array, null given
       
       
      Error code: generalexceptionmessage
       
      * line 864 of /mod/quiz/report/statistics/report.php: TypeError thrown
      * line 864 of /mod/quiz/report/statistics/report.php: call to ksort()
      * line 939 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
      * line 105 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 167 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task()
       
      ... used 18 dbqueries
      ... used 0.044097185134888 seconds
      Scheduled task failed: Recalculate question statistics (quiz_statistics\task\recalculate),ksort(): Argument #1 ($array) must be of type array, null given
      Backtrace:
      * line 864 of /mod/quiz/report/statistics/report.php: call to ksort()
      * line 939 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->load_and_initialise_questions_for_calculations()
      * line 105 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 167 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task()
       
      root@01c31895db1b:/var/www/vanilla-moodle-master# 
      

      Attachments

        Issue Links

          Activity

            People

              scottverbeek Scott Verbeek
              mikhailgolenkov Misha Golenkov
              Tim Hunt Tim Hunt
              Andrew Lyons Andrew Lyons
              Kim Jared Lucas Kim Jared Lucas
              Votes:
              22 Vote for this issue
              Watchers:
              28 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 - 42 minutes
                  42m

                  Clockify

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