Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | List of all members
core_analytics\calculation_info Class Reference

Extra information generated during the analysis by calculable elements. More...

Public Member Functions

 add_shared (int $sampleid, array $info)
 Adds info related to the current calculation for later use when generating insights. More...
 
 save (\core_analytics\calculable $calculable, core_analytics\local\time_splitting\base $timesplitting, int $rangeindex)
 Stores in MUC the previously added data and it associates it to the provided $calculable. More...
 

Static Public Member Functions

static pull_info (array $predictionrecords)
 Pulls the info related to the provided records out from the cache. More...
 

Detailed Description

Extra information generated during the analysis by calculable elements.

The main purpose of this request cache is to allow calculable elements to store data during their calculations for further use at a later stage efficiently.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_shared()

core_analytics\calculation_info::add_shared ( int  $sampleid,
array  $info 
)

Adds info related to the current calculation for later use when generating insights.

Note that the data in $info array is reused across multiple samples, if you want to add data just for this sample you can use the sample id as key.

We store two different arrays so objects that appear multiple times for different samples appear just once in memory.

Parameters
int$sampleidThe sample id this data is associated with
array$infoThe data. Indexed by an id unique across the site. E.g. an activity id.
Return values
null

◆ pull_info()

static core_analytics\calculation_info::pull_info ( array  $predictionrecords)
static

Pulls the info related to the provided records out from the cache.

Note that this function purges 'calculablesinfo' cache.

Parameters
stdClass[]$predictionrecords
Return values
array|false

◆ save()

core_analytics\calculation_info::save ( \core_analytics\calculable  $calculable,
core_analytics\local\time_splitting\base  $timesplitting,
int  $rangeindex 
)

Stores in MUC the previously added data and it associates it to the provided $calculable.

Parameters
core_analytics::calculable$calculable
core_analytics::local::time_splitting::base$timesplitting
int$rangeindex
Return values
null

The documentation for this class was generated from the following file: