A collection of all the question statistics calculated for an activity instance.
More...
|
| any_error_messages () |
| Call after calculations to output any error messages.
|
|
| cache ($qubaids) |
| Save stats to db, first cleaning up any old ones.
|
|
| for_slot ($slot, $variant=null) |
| Get position stats instance for a slot and optional variant no.
|
|
| for_subq ($questionid, $variant=null) |
| Reference for a item stats instance for a questionid and optional variant no.
|
|
| get_all_slots () |
| All slots nos that stats have been calculated for.
|
|
| get_all_subq_ids () |
| ids of all randomly selected question for all slots.
|
|
| get_cached ($qubaids) |
| Load cached statistics from the database.
|
|
| get_last_calculated_time ($qubaids) |
| Find time of non-expired statistics in the database.
|
|
| get_sub_questions () |
| Return all sub-questions used.
|
|
| has_slot ($slot, $variant=null) |
| Do we have stats for a particular slot (and optionally variant)?
|
|
| has_subq ($questionid, $variant=null) |
| Do we have stats for a particular quesitonid (and optionally variant)?
|
|
| initialise_for_slot ($slot, $question, $variant=null) |
| Set up a calculated instance ready to store a slot question's stats.
|
|
| initialise_for_subq ($step, $variant=null) |
| Set up a calculated_for_subquestion instance ready to store a randomly selected question's stats.
|
|
| structure_analysis_for_one_slot ($slot, $limitvariants=false) |
| Return all stats for one slot, stats for the slot itself, and either :
|
|
|
calculated[] | $questionstats = array() |
| Holds slot (position) stats and stats for variants of questions in slots.
|
|
object[] | $subquestions = [] |
|
calculated_for_subquestion[] | $subquestionstats = array() |
| Holds sub-question stats and stats for variants of subqs.
|
|
int const | TIME_TO_CACHE = 900 |
| previously, the time after which statistics are automatically recomputed.
|
|
A collection of all the question statistics calculated for an activity instance.
- Copyright
- 2014 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
◆ all_subq_and_variant_stats_for_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::all_subq_and_variant_stats_for_slot |
( |
| $slot, |
|
|
| $limited ) |
|
protected |
Return all variant or 'sub-question' stats one slot, either :
- variants of question
- variants of randomly selected questions
- randomly selected questions
- Parameters
-
int | $slot | the slot no |
bool | $limited | limit number of variants and sub-questions displayed? |
- Return values
-
calculated|calculated_for_subquestion|calculated_question_summary[] | stats to display |
◆ all_subq_variants_for_one_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::all_subq_variants_for_one_slot |
( |
| $slot | ) |
|
|
protected |
Return all stats for variants of randomly selected questions for one slot $slot.
- Parameters
-
- Return values
-
calculated[] | The instances storing the calculated stats. |
◆ all_subqs_for_one_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::all_subqs_for_one_slot |
( |
| $slot | ) |
|
|
protected |
Return all stats for randomly selected questions for one slot $slot.
- Parameters
-
- Return values
-
calculated[] | The instances storing the calculated stats. |
◆ all_variant_stats_for_one_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::all_variant_stats_for_one_slot |
( |
| $slot | ) |
|
|
protected |
Return all stats for variants of question in slot $slot.
- Parameters
-
- Return values
-
calculated[] | The instances storing the calculated stats. |
◆ any_error_messages()
core_question\statistics\questions\all_calculated_for_qubaid_condition::any_error_messages |
( |
| ) |
|
Call after calculations to output any error messages.
- Return values
-
string[] | Array of strings describing error messages found during stats calculation. |
◆ cache()
core_question\statistics\questions\all_calculated_for_qubaid_condition::cache |
( |
| $qubaids | ) |
|
Save stats to db, first cleaning up any old ones.
- Parameters
-
◆ for_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::for_slot |
( |
| $slot, |
|
|
| $variant = null ) |
Get position stats instance for a slot and optional variant no.
- Parameters
-
int | $slot | The slot no. |
int | null | $variant | if provided then we want the object which stores a variant of a position's stats. |
- Return values
-
calculated|calculated_for_subquestion | An instance of the class storing the calculated position stats. |
- Exceptions
-
coding_exception | if there is an attempt to respond to a non-existant set of stats. |
◆ for_subq()
core_question\statistics\questions\all_calculated_for_qubaid_condition::for_subq |
( |
| $questionid, |
|
|
| $variant = null ) |
Reference for a item stats instance for a questionid and optional variant no.
- Parameters
-
int | $questionid | The id of the sub question. |
int | null | $variant | if not null then we want the object to store a variant of a sub-question's stats. |
- Return values
-
calculated|calculated_for_subquestion | stats instance for a questionid and optional variant no. Will be a calculated_for_subquestion if no variant specified. |
- Exceptions
-
coding_exception | if there is an attempt to respond to a non-existant set of stats. |
◆ get_all_slots()
core_question\statistics\questions\all_calculated_for_qubaid_condition::get_all_slots |
( |
| ) |
|
All slots nos that stats have been calculated for.
- Return values
-
int[] | An array of all slot nos. |
◆ get_all_subq_ids()
core_question\statistics\questions\all_calculated_for_qubaid_condition::get_all_subq_ids |
( |
| ) |
|
ids of all randomly selected question for all slots.
- Return values
-
int[] | An array of all sub-question ids. |
◆ get_cached()
core_question\statistics\questions\all_calculated_for_qubaid_condition::get_cached |
( |
| $qubaids | ) |
|
Load cached statistics from the database.
- Parameters
-
◆ get_last_calculated_time()
core_question\statistics\questions\all_calculated_for_qubaid_condition::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 if non found. |
◆ get_sub_questions()
core_question\statistics\questions\all_calculated_for_qubaid_condition::get_sub_questions |
( |
| ) |
|
Return all sub-questions used.
- Return values
-
object[] | array of questions. |
◆ has_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::has_slot |
( |
| $slot, |
|
|
| $variant = null ) |
Do we have stats for a particular slot (and optionally variant)?
- Parameters
-
int | $slot | The slot no. |
int | null | $variant | if provided then we want the object which stores a variant of a position's stats. |
- Return values
-
bool | whether those stats exist (yet). |
◆ has_subq()
core_question\statistics\questions\all_calculated_for_qubaid_condition::has_subq |
( |
| $questionid, |
|
|
| $variant = null ) |
Do we have stats for a particular quesitonid (and optionally variant)?
- Parameters
-
int | $questionid | The id of the sub question. |
int | null | $variant | if not null then we want the object to store a variant of a sub-question's stats. |
- Return values
-
bool | whether those stats exist (yet). |
◆ initialise_for_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::initialise_for_slot |
( |
| $slot, |
|
|
| $question, |
|
|
| $variant = null ) |
Set up a calculated instance ready to store a slot question's stats.
- Parameters
-
int | $slot | |
object | $question | |
int | null | $variant | Is this to keep track of a variant's stats? If so what is the variant, if not null. |
◆ initialise_for_subq()
core_question\statistics\questions\all_calculated_for_qubaid_condition::initialise_for_subq |
( |
| $step, |
|
|
| $variant = null ) |
Set up a calculated_for_subquestion instance ready to store a randomly selected question's stats.
- Parameters
-
object | $step | |
int | null | $variant | Is this to keep track of a variant's stats? If so what is the variant, if not null. |
◆ make_new_calculated_question_summary_stat()
core_question\statistics\questions\all_calculated_for_qubaid_condition::make_new_calculated_question_summary_stat |
( |
| $randomquestioncalculated, |
|
|
| $subquestionstats ) |
|
protected |
Create a summary calculated object for a calculated question.
This is used as a placeholder to indicate that a calculated question has sub questions or variations to show rather than listing each subquestion or variation directly.
- Parameters
-
calculated | $randomquestioncalculated | The calculated instance for the random question slot. |
calculated[] | $subquestionstats | The instances of the calculated stats of the questions that are being summarised. |
- Return values
-
calculated_question_summary | |
◆ make_new_subq_stat_for()
core_question\statistics\questions\all_calculated_for_qubaid_condition::make_new_subq_stat_for |
( |
| $displaynumber, |
|
|
| $slot, |
|
|
| $subqid, |
|
|
| $variant = null ) |
|
protected |
We need a new object for display.
Sub-question stats can appear more than once in different slots. So we create a clone of the object and then we can set properties on the object that are per slot.
- Parameters
-
int | $displaynumber | The display number for this sub question. |
int | $slot | The slot number. |
int | $subqid | The sub question id. |
null | int | $variant | The variant no. |
- Return values
-
calculated_for_subquestion | The object for display. |
◆ structure_analysis_for_one_slot()
core_question\statistics\questions\all_calculated_for_qubaid_condition::structure_analysis_for_one_slot |
( |
| $slot, |
|
|
| $limitvariants = false ) |
Return all stats for one slot, stats for the slot itself, and either :
- variants of question
- variants of randomly selected questions
- randomly selected questions
- Parameters
-
int | $slot | the slot no |
bool | int | $limitvariants | limit number of variants and sub-questions displayed? |
- Return values
-
calculated|calculated_for_subquestion[] | stats to display |
◆ TIME_TO_CACHE
int const core_question\statistics\questions\all_calculated_for_qubaid_condition::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-78090 Final deprecation in Moodle 4.7
The documentation for this class was generated from the following file:
- question/classes/statistics/questions/all_calculated_for_qubaid_condition.php