Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 244 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

calculated:: (7 methods):
  __construct()
  s()
  avg()
  get_field()
  get_formatted_quiz_info_data()
  cache()
  populate_from_record()


Class: calculated  - X-Ref

The statistics calculator returns an instance of this class which contains the calculated statistics.

These quiz statistics calculations are described here :

http://docs.moodle.org/dev/Quiz_statistics_calculations#Test_statistics

__construct($whichattempts = null)   X-Ref

param: string $whichattempts which attempts to use, represented internally as one of the constants as used in

s()   X-Ref
Count of attempts selected by $this->whichattempts

return: int

avg()   X-Ref
Average grade for the attempts selected by $this->whichattempts

return: float

get_field($field)   X-Ref
Get the right field name to fetch a stat for these attempts that is calculated for more than one $whichattempts (count or
avg).

param: string $field name of field
return: int|float

get_formatted_quiz_info_data($course, $cm, $quiz)   X-Ref

param: $course
param: $cm
param: $quiz
return: array to display in table or spreadsheet.

cache($qubaids)   X-Ref
Cache the stats contained in this class.

param: $qubaids \qubaid_condition

populate_from_record($record)   X-Ref
Given a record from 'quiz_statistics' table load the data into the properties of this class.

param: $record \stdClass from db.