Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
workshop_best_evaluation Class Reference

Defines the computation login of the grading evaluation subplugin. More...

Inheritance diagram for workshop_best_evaluation:
workshop_evaluation

Public Member Functions

 __construct (workshop $workshop)
 Constructor. More...
 
 get_settings_form (moodle_url $actionurl=null)
 Returns an instance of the form to provide evaluation settings. More...
 
 update_grading_grades (stdclass $settings, $restrict=null)
 Calculates the grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table. More...
 
 update_grading_grades (stdClass $settings, $restrict=null)
 Calculates grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table. More...
 

Static Public Member Functions

static delete_instance ($workshopid)
 Delete all data related to a given workshop module instance. More...
 

Protected Member Functions

 assessments_distance (stdclass $assessment, stdclass $referential, array $diminfo, stdclass $settings)
 Measures the distance of the assessment from a referential one. More...
 
 average_assessment (array $assessments)
 Given a set of a submission's assessments, returns a hypothetical average assessment. More...
 
 normalize_grades (array $assessments, array $diminfo)
 Normalizes the dimension grades to the interval 0.00000 - 100.00000. More...
 
 prepare_data_from_recordset ($assessments)
 Prepares a structure of assessments and given grades. More...
 
 process_assessments (array $assessments, array $diminfo, stdclass $settings)
 Given a list of all assessments of a single submission, updates the grading grades in database. More...
 
 weighted_variance (array $assessments)
 Given a set of a submission's assessments, returns standard deviations of all their dimensions. More...
 

Protected Attributes

the $settings
 recently used settings in this workshop
 
workshop $workshop
 the parent workshop instance
 

Detailed Description

Defines the computation login of the grading evaluation subplugin.

Constructor & Destructor Documentation

◆ __construct()

workshop_best_evaluation::__construct ( workshop  $workshop)

Constructor.

Parameters
workshop$workshopThe workshop api instance
Return values
void

Member Function Documentation

◆ assessments_distance()

workshop_best_evaluation::assessments_distance ( stdclass  $assessment,
stdclass  $referential,
array  $diminfo,
stdclass  $settings 
)
protected

Measures the distance of the assessment from a referential one.

The passed data structures must contain ->dimgrades property. The referential assessment is supposed to be close to the average assessment. All dimension grades are supposed to be normalized to the interval 0 - 100. Returned value is rounded to 4 valid decimals to prevent some rounding issues - see the unit test for an example.

Parameters
stdClass$assessmentthe assessment being measured
stdClass$referentialassessment
array$diminfoof stdclass(->weight ->min ->max ->variance) indexed by dimension id
stdClass$settings
Return values
float|nullrounded to 4 valid decimals

◆ average_assessment()

workshop_best_evaluation::average_assessment ( array  $assessments)
protected

Given a set of a submission's assessments, returns a hypothetical average assessment.

The passed structure must be array of assessments objects with ->weight and ->dimgrades properties. Returns null if all passed assessments have zero weight as there is nothing to choose from then.

Parameters
array$assessmentsas prepared by self::prepare_data_from_recordset()
Return values
null|stdClass

◆ delete_instance()

static workshop_best_evaluation::delete_instance (   $workshopid)
static

Delete all data related to a given workshop module instance.

See also
workshop_delete_instance()
Parameters
int$workshopidid of the workshop module instance being deleted
Return values
void

Reimplemented from workshop_evaluation.

◆ get_settings_form()

workshop_best_evaluation::get_settings_form ( moodle_url  $actionurl = null)

Returns an instance of the form to provide evaluation settings.

Return values
workshop_best_evaluation_settings_form

Reimplemented from workshop_evaluation.

◆ normalize_grades()

workshop_best_evaluation::normalize_grades ( array  $assessments,
array  $diminfo 
)
protected

Normalizes the dimension grades to the interval 0.00000 - 100.00000.

Note: this heavily relies on PHP5 way of handling references in array of stdclasses. Hopefully it will not change again soon.

Parameters
array$assessmentsof stdclass as returned by {
See also
self::prepare_data_from_recordset()}
Parameters
array$diminfoof stdclass
Return values
arrayof stdclass with the same structure as $assessments

◆ prepare_data_from_recordset()

workshop_best_evaluation::prepare_data_from_recordset (   $assessments)
protected

Prepares a structure of assessments and given grades.

Parameters
array$assessmentsbatch of recordset items as returned by the grading strategy
Return values
array

◆ process_assessments()

workshop_best_evaluation::process_assessments ( array  $assessments,
array  $diminfo,
stdclass  $settings 
)
protected

Given a list of all assessments of a single submission, updates the grading grades in database.

Parameters
array$assessmentsof stdclass (->assessmentid ->assessmentweight ->reviewerid ->gradinggrade ->submissionid ->dimensionid ->grade)
array$diminfoof stdclass (->id ->weight ->max ->min)
stdClassgrading evaluation settings
Return values
void

◆ update_grading_grades() [1/2]

workshop_best_evaluation::update_grading_grades ( stdclass  $settings,
  $restrict = null 
)

Calculates the grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table.

This function relies on the grading strategy subplugin providing get_assessments_recordset() method. {

See also
self::process_assessments()} for the required structure of the recordset.
Parameters
stdClass$settingsThe settings for this round of evaluation
null | int | array$restrictIf null, update all reviewers, otherwise update just grades for the given reviewers(s)
Return values
void

◆ update_grading_grades() [2/2]

workshop_evaluation::update_grading_grades ( stdClass  $settings,
  $restrict = null 
)
abstractinherited

Calculates grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table.

Parameters
stdClass$settingssettings for this round of evaluation
null | int | array$restrictif null, update all reviewers, otherwise update just grades for the given reviewers(s)

◆ weighted_variance()

workshop_best_evaluation::weighted_variance ( array  $assessments)
protected

Given a set of a submission's assessments, returns standard deviations of all their dimensions.

The passed structure must be array of assessments objects with at least ->weight and ->dimgrades properties. This implementation uses weighted incremental algorithm as suggested in "D. H. D. West (1979). Communications of the ACM, 22, 9, 532-535: Updating Mean and Variance Estimates: An Improved Method" http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Weighted_incremental_algorithm

Parameters
array$assessmentsas prepared by self::prepare_data_from_recordset()
Return values
null|arrayindexed by dimension id

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