mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-75576 quiz statistics: don't compute when a user views the qbank
Previously, when users viewed the question bank, if the quiz statistics had not already been calculated, we would try to compute them there an then. This could be very, very slow, leading to session lock problems. Now, we never try to compute the statistics on the fly. Instead, we rely on the existing \quiz_statistics\task\recalculate scheduled task to do it.
This commit is contained in:
parent
bc7dacecb6
commit
b112cee58c
6 changed files with 44 additions and 6 deletions
|
@ -72,6 +72,7 @@ Feature: Show statistics in question bank
|
|||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | True |
|
||||
And I run the scheduled task "\quiz_statistics\task\recalculate"
|
||||
When I am on the "Course 1" "core_question > course question bank" page logged in as "admin"
|
||||
Then I should see "50.00%" in the "TF1" "table_row"
|
||||
And I should see "75.00%" in the "TF2" "table_row"
|
||||
|
@ -87,6 +88,7 @@ Feature: Show statistics in question bank
|
|||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | True |
|
||||
And I run the scheduled task "\quiz_statistics\task\recalculate"
|
||||
When I am on the "Course 1" "core_question > course question bank" page logged in as "admin"
|
||||
Then I should see "50.00%" in the "TF1" "table_row"
|
||||
And I should see "75.00%" in the "TF2" "table_row"
|
||||
|
@ -102,6 +104,7 @@ Feature: Show statistics in question bank
|
|||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | True |
|
||||
And I run the scheduled task "\quiz_statistics\task\recalculate"
|
||||
When I am on the "Course 1" "core_question > course question bank" page logged in as "admin"
|
||||
Then I should see "Likely" in the "TF1" "table_row"
|
||||
And I should see "Unlikely" in the "TF2" "table_row"
|
||||
|
@ -123,6 +126,7 @@ Feature: Show statistics in question bank
|
|||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | False |
|
||||
And I run the scheduled task "\quiz_statistics\task\recalculate"
|
||||
When I am on the "Course 1" "core_question > course question bank" page logged in as "admin"
|
||||
Then I should see "Likely" in the "TF1" "table_row"
|
||||
And I should see "Very likely" in the "TF2" "table_row"
|
||||
|
|
|
@ -225,6 +225,12 @@ class helper_test extends \advanced_testcase {
|
|||
foreach ($quiz2attempts as $attempt) {
|
||||
$this->submit_quiz($quiz2, $attempt);
|
||||
}
|
||||
|
||||
// Calculate the statistics.
|
||||
$this->expectOutputRegex('~.*Calculations completed.*~');
|
||||
$statisticstask = new \quiz_statistics\task\recalculate();
|
||||
$statisticstask->execute();
|
||||
|
||||
return [$quiz1, $quiz2, $questions];
|
||||
}
|
||||
|
||||
|
|
|
@ -232,6 +232,12 @@ class statistics_bulk_loader_test extends advanced_testcase {
|
|||
foreach ($quiz2attempts as $attempt) {
|
||||
$this->submit_quiz($quiz2, $attempt);
|
||||
}
|
||||
|
||||
// Calculate the statistics.
|
||||
$this->expectOutputRegex('~.*Calculations completed.*~');
|
||||
$statisticstask = new \quiz_statistics\task\recalculate();
|
||||
$statisticstask->execute();
|
||||
|
||||
return [$quiz1, $quiz2, $questions];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue