Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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.