Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

Question statistics calculations class. Used in the quiz statistics report.

Copyright: 2018 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 184 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

calculated_question_summary:: (6 methods):
  __construct()
  break_down_by_variant()
  get_min_max_of()
  get_min_max_of_sd()
  max()
  min()


Class: calculated_question_summary  - X-Ref

Class calculated_question_summary

This class is used to indicate the statistics for a random question slot should
be rendered with a link to a summary of the displayed questions.

It's used in the limited view of the statistics calculation in lieu of adding
the stats for each subquestion individually.

__construct($question, $slot, $subqstats)   X-Ref
calculated_question_summary constructor.

param: \stdClass $question
param: int $slot
param: calculated[] $subqstats The instances of the calculated stats of the questions that are being summarised.

break_down_by_variant()   X-Ref
This is a summary stat so never breakdown by variant.

return: bool

get_min_max_of($attribute)   X-Ref
Returns the minimum and maximum values of the given attribute in the summarised calculated stats.

param: string $attribute The attribute that we are looking for its extremums.
return: array An array of [min,max]

get_min_max_of_sd()   X-Ref
Returns the minimum and maximum values of the standard deviation in the summarised calculated stats.

return: array An array of [min,max]

max(float $value1 = null, float $value2 = null)   X-Ref
Find higher value.
A zero value is almost considered equal to zero in comparisons. The only difference is that when being compared to zero,
zero is higher than null.

param: float|null $value1
param: float|null $value2
return: float|null

min(float $value1 = null, float $value2 = null)   X-Ref
Find lower value.
A zero value is almost considered equal to zero in comparisons. The only difference is that when being compared to zero,
zero is lower than null.

param: float|null $value1
param: float|null $value2
return: mixed|null