Skip to content

Commit

Permalink
Merge branch 'MDL-42494-workshop-exception' of git://github.com/mudrd…
Browse files Browse the repository at this point in the history
…8mz/moodle
  • Loading branch information
danpoltawski committed Nov 4, 2013
2 parents 23f13c5 + e01d4a2 commit b763a03
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mod/workshop/eval/best/lib.php
Expand Up @@ -163,6 +163,16 @@ protected function process_assessments(array $assessments, array $diminfo, stdcl
// get a hypothetical average assessment
$average = $this->average_assessment($assessments);

// if unable to calculate the average assessment, set the grading grades to null
if (is_null($average)) {
foreach ($assessments as $asid => $assessment) {
if (!is_null($assessment->gradinggrade)) {
$DB->set_field('workshop_assessments', 'gradinggrade', null, array('id' => $asid));
}
}
return;
}

// calculate variance of dimension grades
$variances = $this->weighted_variance($assessments);
foreach ($variances as $dimid => $variance) {
Expand Down Expand Up @@ -272,6 +282,8 @@ protected function normalize_grades(array $assessments, array $diminfo) {
* 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.
*
* @param array $assessments as prepared by {@link self::prepare_data_from_recordset()}
* @return null|stdClass
Expand Down

0 comments on commit b763a03

Please sign in to comment.