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]

This file contains the code to analyse all the responses to a particular question.

Author: Jamie Pratt <me@jamiep.org>
Copyright: 2014 Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 193 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

analyser:: (6 methods):
  __construct()
  has_subparts()
  has_response_classes()
  calculate()
  load_cached()
  get_last_analysed_time()


Class: analyser  - X-Ref

This class can compute, store and cache the analysis of the responses to a particular question.

__construct($questiondata, $whichtries = \question_attempt::LAST_TRY)   X-Ref
Create a new instance of this class for holding/computing the statistics
for a particular question.

param: object $questiondata the full question data from the database defining this question.
param: string $whichtries   which tries to analyse.

has_subparts()   X-Ref
Does the computed analysis have sub parts?

return: bool whether this analysis has more than one subpart.

has_response_classes()   X-Ref
Does the computed analysis's sub parts have classes?

return: bool whether this analysis has (a subpart with) more than one response class.

calculate($qubaids, $whichtries = \question_attempt::LAST_TRY)   X-Ref
Analyse all the response data for for all the specified attempts at this question.

param: \qubaid_condition $qubaids which attempts to consider.
param: string $whichtries         which tries to analyse. Will be one of
return: analysis_for_question

load_cached($qubaids, $whichtries)   X-Ref
Retrieve the computed response analysis from the question_response_analysis table.

param: \qubaid_condition $qubaids    load the analysis of which question usages?
param: string            $whichtries load the analysis of which tries?
return: analysis_for_question|boolean analysis or false if no cached analysis found.

get_last_analysed_time($qubaids, $whichtries)   X-Ref
Find time of non-expired analysis in the database.

param: \qubaid_condition $qubaids    check for the analysis of which question usages?
param: string            $whichtries check for the analysis of which tries?
return: integer|boolean Time of cached record that matches this qubaid_condition or false if none found.