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

Question bank statistics still being pulled/loaded when associated columns disabled

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78488_401
    • MDL-78488_402
    • Show
      Comment out the following line: https://github.com/moodle/moodle/blob/3cd84747cb0c86ab5d5f7394fc6f01bcb24c4389/question/classes/local/bank/view.php#L994
    • Hide
      Setup
      1. Add the following line inside the function mod_quiz_calculate_question_stats in mod/quiz/lib.php. (last function in the file)

            error_log(__FUNCTION__ . ' called');
        

      2. Open a terminal and tail your web server's error log. e.g. in Ubuntu

        tail -f /var/log/apache2/error.log
        

      Test
      1. As a teacher create a quiz with a simple true/false question
      2. As a student attempt the quiz
      3. Submit the attempt
      4. As a teacher open the question bank for the course containing the quiz
      5. Verify on the error log that the function `mod_quiz_calculate_question_stats` is called when loading the question bank page
      6. As an admin go to site administration -> Plugins -> Question bank plugins -> Manage question bank plugins
      7. Click on the eye symbol next to Question statistics to disable them
      8. As a teacher open the question bank for the course containing the quiz
      9. Verify on the error log that the function `mod_quiz_calculate_question_stats` is not called when loading the question bank page
      Show
      Setup Add the following line inside the function mod_quiz_calculate_question_stats in mod/quiz/lib.php. (last function in the file) error_log ( __FUNCTION__ . ' called' ); Open a terminal and tail your web server's error log. e.g. in Ubuntu tail -f /var/log/apache2/error .log Test As a teacher create a quiz with a simple true/false question As a student attempt the quiz Submit the attempt As a teacher open the question bank for the course containing the quiz Verify on the error log that the function `mod_quiz_calculate_question_stats` is called when loading the question bank page As an admin go to site administration -> Plugins -> Question bank plugins -> Manage question bank plugins Click on the eye symbol next to Question statistics to disable them As a teacher open the question bank for the course containing the quiz Verify on the error log that the function `mod_quiz_calculate_question_stats` is not called when loading the question bank page

      Related to update MDL-75576

      After the update, it appears that question bank statistics are being loaded/pulled even when all statistic columns have been disabled. For our systems, we needed to disable these statistics due to some large question banks with numerous attempts.

      I could verify the issue by commenting out the following call in question/classes/local/bank/view.php around line 1046.

      $this->loadedstatistics = statistics_bulk_loader::load_aggregate_statistics(
                      array_keys($questions), $requiredstatistics);

      This change made a factor of a bank loading after 5-6 minutes to seconds.

        1. MDL-78488.png
          278 kB
          Ron Carl Alfon Yu

            tschroeder Tim Schroeder
            rachel.martin Rachel Martin
            Tim Hunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            5 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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