Merge branch 'MDL-57999_2' of https://github.com/zoebogner/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 7 Mar 2017 14:12:32 +0000 (11:12 -0300)
committerDan Poltawski <dan@moodle.com>
Tue, 7 Mar 2017 14:12:32 +0000 (11:12 -0300)
grade/report/user/externallib.php
grade/report/user/lib.php
grade/report/user/tests/externallib_test.php

index d002d00..5d7bbb6 100644 (file)
@@ -483,6 +483,7 @@ class gradereport_user_external extends external_api {
                                 new external_single_structure(
                                     array(
                                         'id' => new external_value(PARAM_INT, 'Grade item id'),
+                                        'itemname' => new external_value(PARAM_TEXT, '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'),
index 9f751fa..ea40100 100644 (file)
@@ -512,6 +512,7 @@ class grade_report_user extends grade_report {
 
                 // Basic grade item information.
                 $gradeitemdata['id'] = $grade_object->id;
+                $gradeitemdata['itemname'] = $grade_object->itemname;
                 $gradeitemdata['itemtype'] = $grade_object->itemtype;
                 $gradeitemdata['itemmodule'] = $grade_object->itemmodule;
                 $gradeitemdata['iteminstance'] = $grade_object->iteminstance;
index 02c79e4..e751434 100644 (file)
@@ -251,6 +251,7 @@ class gradereport_user_externallib_testcase extends externallib_advanced_testcas
         $this->assertEquals($course->id, $studentgrades['usergrades'][0]['courseid']);
         $this->assertEquals($student1->id, $studentgrades['usergrades'][0]['userid']);
         // Module grades.
+        $this->assertEquals($assignment->name, $studentgrades['usergrades'][0]['gradeitems'][0]['itemname']);
         $this->assertEquals('mod', $studentgrades['usergrades'][0]['gradeitems'][0]['itemtype']);
         $this->assertEquals('assign', $studentgrades['usergrades'][0]['gradeitems'][0]['itemmodule']);
         $this->assertEquals($assignment->id, $studentgrades['usergrades'][0]['gradeitems'][0]['iteminstance']);
@@ -325,6 +326,7 @@ class gradereport_user_externallib_testcase extends externallib_advanced_testcas
 
         $this->assertEquals($course->id, $studentgrades['usergrades'][0]['courseid']);
         $this->assertEquals($student1->id, $studentgrades['usergrades'][0]['userid']);
+        $this->assertEquals($assignment->name, $studentgrades['usergrades'][0]['gradeitems'][0]['itemname']);
         $this->assertEquals('mod', $studentgrades['usergrades'][0]['gradeitems'][0]['itemtype']);
         $this->assertEquals('assign', $studentgrades['usergrades'][0]['gradeitems'][0]['itemmodule']);
         $this->assertEquals($assignment->id, $studentgrades['usergrades'][0]['gradeitems'][0]['iteminstance']);