MDL-80017 core_grades: Fix return type for itemname

This commit is contained in:
Juan Leyva
2024-07-25 11:16:45 +02:00
parent 8efeae492e
commit 5e4e5bf13e
5 changed files with 13 additions and 4 deletions
@@ -0,0 +1,9 @@
issueNumber: MDL-80017
notes:
core_grades:
- message: >
The grade `itemname` property contained in the return structure of
the following external methods is now PARAM_RAW:
- `core_grades_get_gradeitems`
- `gradereport_user_get_grade_items`
type: changed
+1 -1
View File
@@ -96,7 +96,7 @@ class get_gradeitems extends external_api {
'gradeItems' => new external_multiple_structure(
new external_single_structure([
'id' => new external_value(PARAM_ALPHANUM, 'An ID for the grade item', VALUE_REQUIRED),
'itemname' => new external_value(PARAM_CLEANHTML, 'The full name of the grade item', VALUE_REQUIRED),
'itemname' => new external_value(PARAM_RAW, 'The full name of the grade item', VALUE_REQUIRED),
'category' => new external_value(PARAM_TEXT, 'The grade category of the grade item', VALUE_OPTIONAL),
])
),
+1 -1
View File
@@ -509,7 +509,7 @@ class user extends external_api {
new external_single_structure(
[
'id' => new external_value(PARAM_INT, 'Grade item id'),
'itemname' => new external_value(PARAM_CLEANHTML, 'Grade item name'),
'itemname' => new external_value(PARAM_RAW, 'Grade item name'),
'itemtype' => new external_value(PARAM_ALPHA, 'Grade item type'),
'itemmodule' => new external_value(PARAM_PLUGIN, 'Grade item module'),
'iteminstance' => new external_value(PARAM_INT, 'Grade item instance'),
+1 -1
View File
@@ -72,7 +72,7 @@ class externallib_test extends externallib_advanced_testcase {
groups_add_member($group1->id, $teacher->id);
groups_add_member($group2->id, $student2->id);
$assignment = $this->getDataGenerator()->create_module('assign', ['name' => "Test assign", 'course' => $course->id]);
$assignment = $this->getDataGenerator()->create_module('assign', ['name' => "Test assign & grade items", 'course' => $course->id]);
$modcontext = get_coursemodule_from_instance('assign', $assignment->id, $course->id);
$assignment->cmidnumber = $modcontext->id;
+1 -1
View File
@@ -41,7 +41,7 @@ class get_gradeitems_test extends \externallib_advanced_testcase {
$course = $this->getDataGenerator()->create_course();
$this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
$this->getDataGenerator()->create_module('h5pactivity', ['course' => $course->id]);
$this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
$this->getDataGenerator()->create_module('assign', ['course' => $course->id, 'name' => 'Assignment & grade items']);
$result = get_gradeitems::execute($course->id);
$result = external_api::clean_returnvalue(get_gradeitems::execute_returns(), $result);