mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-60378-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
23892d0843
@ -1280,6 +1280,10 @@ class mod_workshop_external extends external_api {
|
||||
}
|
||||
}
|
||||
|
||||
// Get dimensions info.
|
||||
$grader = $workshop->grading_strategy_instance();
|
||||
$result['dimensionsinfo'] = $grader->get_dimensions_info();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1318,6 +1322,17 @@ class mod_workshop_external extends external_api {
|
||||
)
|
||||
), '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 @@ class workshop_accumulative_strategy implements workshop_strategy {
|
||||
// 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 @@ interface workshop_strategy {
|
||||
/**
|
||||
* 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 @@ class mod_workshop_external_testcase extends externallib_advanced_testcase {
|
||||
$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
|
||||
|
Loading…
x
Reference in New Issue
Block a user