Class to calculate and also manage caching of quiz statistics.
More...
|
static | using_attempts_lang_string ($whichattempts) |
| Given a particular quiz grading method return a lang string describing which attempts contribute to grade.
|
|
static | using_attempts_string_id ($whichattempts) |
| Given a particular quiz grading method return a string id for use as a field name prefix in mdl_quiz_statistics or to fetch the appropriate language string describing which attempts contribute to grade.
|
|
|
int const | TIME_TO_CACHE = 900 |
| previously, the time after which statistics are automatically recomputed.
|
|
|
core progress base | $progress |
|
Class to calculate and also manage caching of quiz statistics.
These quiz statistics calculations are described here :
http://docs.moodle.org/dev/Quiz_statistics_calculations#Test_statistics
- Copyright
- 2013 The Open University
- Author
- James Pratt me@ja.nosp@m.miep.nosp@m..org
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ attempt_counts_and_averages()
quiz_statistics\calculator::attempt_counts_and_averages |
( |
| $quizid, |
|
|
core\dml\sql_join | $groupstudentsjoins ) |
|
protected |
◆ calculate()
quiz_statistics\calculator::calculate |
( |
| $quizid, |
|
|
| $whichattempts, |
|
|
core\dml\sql_join | $groupstudentsjoins, |
|
|
| $p, |
|
|
| $sumofmarkvariance ) |
Compute the quiz statistics.
- Parameters
-
int | $quizid | the quiz id. |
int | $whichattempts | which attempts to use, represented internally as one of the constants as used in $quiz->grademethod ie. QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST we calculate stats based on which attempts would affect the grade for each student. |
core\dml\sql_join | $groupstudentsjoins | Contains joins, wheres, params for students in this group. |
int | $p | number of positions (slots). |
float | $sumofmarkvariance | sum of mark variance, calculated as part of question statistics |
- Return values
-
calculated\$quizstats | The statistics for overall attempt scores. |
◆ get_cached()
quiz_statistics\calculator::get_cached |
( |
| $qubaids | ) |
|
Load cached statistics from the database.
- Parameters
-
- Return values
-
calculated|false | The statistics for overall attempt scores or false if not cached. |
◆ get_last_calculated_time()
quiz_statistics\calculator::get_last_calculated_time |
( |
| $qubaids | ) |
|
Find time of non-expired statistics in the database.
- Parameters
-
- Return values
-
int|bool | Time of cached record that matches this qubaid_condition or false is non found. |
◆ median()
quiz_statistics\calculator::median |
( |
| $s, |
|
|
| $fromqa, |
|
|
| $whereqa, |
|
|
| $qaparams ) |
|
protected |
◆ sum_of_powers_of_difference_to_mean()
quiz_statistics\calculator::sum_of_powers_of_difference_to_mean |
( |
| $mean, |
|
|
| $fromqa, |
|
|
| $whereqa, |
|
|
| $qaparams ) |
|
protected |
Fetch the sum of squared, cubed and to the power 4 differences between sumgrade and it's mean.
Explanation here : http://docs.moodle.org/dev/Quiz_item_analysis_calculations_in_practise #Calculating_Standard_Deviation.2C_Skewness_and_Kurtosis_of_grades_for_all_attempts_by_students
- Parameters
-
$mean | |
$fromqa | |
$whereqa | |
$qaparams | |
- Return values
-
stdClass | with properties power2, power3, power4 |
◆ using_attempts_lang_string()
static quiz_statistics\calculator::using_attempts_lang_string |
( |
| $whichattempts | ) |
|
|
static |
Given a particular quiz grading method return a lang string describing which attempts contribute to grade.
Note internally we use the grading method constants to represent which attempts we are calculating statistics for, each grading method corresponds to different attempts for each user.
- Parameters
-
int | $whichattempts | which attempts to use, represented internally as one of the constants as used in $quiz->grademethod ie. QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST we calculate stats based on which attempts would affect the grade for each student. |
- Return values
-
string | the appropriate lang string to describe this option. |
◆ using_attempts_string_id()
static quiz_statistics\calculator::using_attempts_string_id |
( |
| $whichattempts | ) |
|
|
static |
Given a particular quiz grading method return a string id for use as a field name prefix in mdl_quiz_statistics or to fetch the appropriate language string describing which attempts contribute to grade.
Note internally we use the grading method constants to represent which attempts we are calculating statistics for, each grading method corresponds to different attempts for each user.
- Parameters
-
int | $whichattempts | which attempts to use, represented internally as one of the constants as used in $quiz->grademethod ie. QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST we calculate stats based on which attempts would affect the grade for each student. |
- Return values
-
string | the string id for this option. |
◆ TIME_TO_CACHE
int const quiz_statistics\calculator::TIME_TO_CACHE = 900 |
previously, the time after which statistics are automatically recomputed.
- Deprecated
- since Moodle 4.3. Use of pre-computed stats is no longer time-limited.
- Todo
- MDL-78091 Final deprecation in Moodle 4.7
The documentation for this class was generated from the following file: