Skip to content
Permalink
Browse files
Merge branch 'MDL-60378-master' of git://github.com/jleyva/moodle
  • Loading branch information
David Monllao committed Oct 19, 2017
2 parents eef0ce9 + fe7b3e7 commit 23892d084357ace8111df9f47a86a3be21578a96
Showing with 28 additions and 1 deletion.
  1. +15 −0 mod/workshop/classes/external.php
  2. +1 −0 mod/workshop/form/accumulative/lib.php
  3. +1 −1 mod/workshop/form/lib.php
  4. +7 −0 mod/workshop/tests/external_test.php
  5. +4 −0 mod/workshop/upgrade.txt
@@ -1280,6 +1280,10 @@ public static function get_assessment_form_definition($assessmentid, $mode = 'as
}
}

// Get dimensions info.
$grader = $workshop->grading_strategy_instance();
$result['dimensionsinfo'] = $grader->get_dimensions_info();

return $result;
}

@@ -1318,6 +1322,17 @@ public static function get_assessment_form_definition_returns() {
)
), 'The current field values.'
),
'dimensionsinfo' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Dimension id.'),
'min' => new external_value(PARAM_FLOAT, 'Minimum grade for the dimension.'),
'max' => new external_value(PARAM_FLOAT, 'Maximum grade for the dimension.'),
'weight' => new external_value(PARAM_TEXT, 'The weight of the dimension.'),
'scale' => new external_value(PARAM_TEXT, 'Scale items (if used).', VALUE_OPTIONAL),
)
), 'The dimensions general information.'
),
'warnings' => new external_warnings()
)
);
@@ -346,6 +346,7 @@ public function get_dimensions_info() {
// the dimension uses a scale
$diminfo[$dimid]->min = 1;
$diminfo[$dimid]->max = count(explode(',', $dimrecord->scale));
$diminfo[$dimid]->scale = $dimrecord->scale;
} else {
// the dimension uses points
$diminfo[$dimid]->min = 0;
@@ -84,7 +84,7 @@ public function form_ready();
/**
* Returns a general information about the assessment dimensions
*
* @return array [dimid] => stdclass (->id ->max ->min ->weight)
* @return array [dimid] => stdclass (->id ->max ->min ->weight and optionally ->scale containing scale items)
*/
public function get_dimensions_info();

@@ -1312,6 +1312,13 @@ public function test_get_assessment_form_definition_reviewer_new_assessment() {
$this->assertEquals(25, $field['value']); // Check one of the dimension fields attributes.
}
}
// Check dimensions grading info.
foreach ($result['dimensionsinfo'] as $dimension) {
$this->assertEquals(0, $dimension['min']);
$this->assertEquals(25, $dimension['max']);
$this->assertEquals(25, $dimension['weight']);
$this->assertFalse(isset($dimension['scale']));
}
}

/**
@@ -1,6 +1,10 @@
This files describes API changes in /mod/workshop - activity modules,
information provided here is intended especially for developers.

=== 3.4 ===

* workshop_strategy::get_dimensions_info now returns also the scale items (if scales are being used).

=== 3.3.2 ===

* workshop_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function

0 comments on commit 23892d0

Please sign in to comment.