1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

Merge branch 'MDL-80017-master' of https://github.com/jleyva/moodle

This commit is contained in:
Huong Nguyen 2024-08-01 09:11:37 +07:00
commit c81be53a7b
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
5 changed files with 13 additions and 4 deletions
.upgradenotes
grade
classes/external
report/user
classes/external
tests
tests/external

@ -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

@ -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),
])
),

@ -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'),

@ -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;

@ -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);