Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

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: 187 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