Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_question\statistics\questions\calculated_for_subquestion Class Reference

A class to store calculated stats for a sub question. More...

Inheritance diagram for core_question\statistics\questions\calculated_for_subquestion:
core_question\statistics\questions\calculated

Public Member Functions

 __construct ($step=null, $variant=null)
 Constructor.
 
 break_down_by_variant ()
 Do we break down the stats for this question by variant or not?
 
 cache ($qubaids, $timemodified=null)
 Cache calculated stats stored in this object in 'question_statistics' table.
 
 clear_variants ()
 Delete the data structure for storing variant stats.
 
 get_sub_question_ids ()
 Get any sub question ids for this question.
 
 get_variants ()
 Array of variants that have appeared in the attempt data for this question.
 
 populate_from_record ($record)
 Load properties of this class from db record.
 
 random_selector_string ()
 Used to determine which random questions pull sub questions from the same pools.
 
 sort_variants ()
 Sort the variants of this question by variant number.
 

Public Attributes

 $covariance
 
 $covariancemax
 
 $covariancemaxsum = 0
 
 $covariancesum = 0
 
 $covariancewithoverallmark
 
 $covariancewithoverallmarksum = 0
 
bool $differentweights = false
 Have the slots this sub question has been used in got different grades?
 
float $discriminationindex
 
float $discriminativeefficiency
 
float $effectiveweight
 effective weight of this question.
 
float $facility
 
 $markarray = array()
 
 $markaverage
 
 $markvariance
 
 $markvariancesum = 0
 
float $maxmark
 max mark achievable for this question.
 
string $minmedianmaxnotice = ''
 if this stat has been picked as a min, median or maximum facility value then this string says which stat this is.
 
 $negcovar = 0
 
 $othermarkaverage
 
 $othermarksarray = array()
 
 $othermarkvariance
 
 $othermarkvariancesum = 0
 
string $positions
 comma separated list of the positions in which this question appears.
 
object $question
 full question data
 
 $questionid
 
null float $randomguessscore = null
 The average score that students would have got by guessing randomly.
 
int $s = 0
 total attempts at this question.
 
float $sd
 standard deviation
 
 $slot = null
 
int $subqdisplayorder
 only set immediately before display in the table.
 
 $subquestion = true
 
 $subquestions = ''
 
float $summarksaverage
 The average for all attempts, of the sum of the marks for all positions in which this item appeared.
 
integer $timemodified
 Set if this record has been retrieved from cache.
 
 $totalmarks = 0
 
 $totalothermarks = 0
 
float $totalsummarks = 0
 The total of marks achieved for all positions in all attempts where this item was seen.
 
array $usedin = array()
 What slots is this sub question used in?
 
null integer $variant = null
 if this property is not null then this is the stats for a variant of a question or when inherited by calculated_for_subquestion and not null then this is the stats for a variant of a sub question.
 
calculated[] $variantstats = array()
 An array of calculated stats for each variant of the question.
 

Protected Attributes

 $fieldsindb
 

Detailed Description

A class to store calculated stats for a sub question.

Author
James Pratt me@ja.nosp@m.miep.nosp@m..org
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_question\statistics\questions\calculated_for_subquestion::__construct ( $step = null,
$variant = null )

Constructor.

Parameters
object | null$stepthe step data for the step that this sub-question was first encountered in.
int | null$variantthe variant no

Member Function Documentation

◆ break_down_by_variant()

core_question\statistics\questions\calculated::break_down_by_variant ( )
inherited

Do we break down the stats for this question by variant or not?

Return values
boolDo we?

Reimplemented in core_question\statistics\questions\calculated_question_summary.

◆ cache()

core_question\statistics\questions\calculated::cache ( $qubaids,
$timemodified = null )
inherited

Cache calculated stats stored in this object in 'question_statistics' table.

Parameters
qubaid_condition$qubaids
int | null$timemodifiedthe modified time to store. Defaults to the current time.

◆ get_sub_question_ids()

core_question\statistics\questions\calculated::get_sub_question_ids ( )
inherited

Get any sub question ids for this question.

Return values
int[]array of sub-question ids or empty array if there are none.

◆ get_variants()

core_question\statistics\questions\calculated::get_variants ( )
inherited

Array of variants that have appeared in the attempt data for this question.

Or an empty array if there is only one variant.

Return values
int[]the variant nos.

◆ populate_from_record()

core_question\statistics\questions\calculated::populate_from_record ( $record)
inherited

Load properties of this class from db record.

Parameters
object$recordGiven a record from 'question_statistics' copy stats from record to properties.

◆ random_selector_string()

core_question\statistics\questions\calculated::random_selector_string ( )
inherited

Used to determine which random questions pull sub questions from the same pools.

Where pool means category and possibly all the sub categories of that category.

Return values
null|stringrepresents the pool of questions from which this question draws if it is random, or null if not.

Member Data Documentation

◆ $fieldsindb

core_question\statistics\questions\calculated::$fieldsindb
protectedinherited
Initial value:
= array('questionid', 'slot', 'subquestion', 's', 'effectiveweight', 'negcovar', 'discriminationindex',
'discriminativeefficiency', 'sd', 'facility', 'subquestions', 'maxmark', 'positions', 'randomguessscore', 'variant')

◆ $minmedianmaxnotice

string core_question\statistics\questions\calculated::$minmedianmaxnotice = ''
inherited

if this stat has been picked as a min, median or maximum facility value then this string says which stat this is.

Prepended to question name for display.

◆ $randomguessscore

null float core_question\statistics\questions\calculated::$randomguessscore = null
inherited

The average score that students would have got by guessing randomly.

Or null if not calculable.

◆ $subqdisplayorder

int core_question\statistics\questions\calculated_for_subquestion::$subqdisplayorder

only set immediately before display in the table.

The order of display in the table.

◆ $timemodified

integer core_question\statistics\questions\calculated::$timemodified
inherited

Set if this record has been retrieved from cache.

This is the time that the statistics were calculated.

◆ $variantstats

calculated [] core_question\statistics\questions\calculated::$variantstats = array()
inherited

An array of calculated stats for each variant of the question.

Even when there is just one variant we still calculate this data as there is no way to know if there are variants before we have finished going through the attempt data one time.

$variants


The documentation for this class was generated from the following file: