Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46527

get_grades Web Service doesn't return all the course grade items when a grade has both grades and outcomes

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Inside a course create a couple of activities, in the gradebook assign grades to that activities.
      2. Enable "Mobile services": Plugins ► Web Services ► External services
      3. Create a Token:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Click add, select user and service (Mobile Service)
      5. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the courseid and userids values .
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=f40pv08phpbc79boa0oh8h2r94' -H 'Connection: keep-alive' --data 'courseid=2&userids%5B0%5D=3&wsfunction=core_grades_get_grades&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed
          

      6. Confirm that:
        • The result of that curl call list all your grades in the course including the final course grade, you can format the json using this online tool: jsonlint.com
      Show
      Inside a course create a couple of activities, in the gradebook assign grades to that activities. Enable "Mobile services": Plugins ► Web Services ► External services Create a Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the courseid and userids values . You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=f40pv08phpbc79boa0oh8h2r94' -H 'Connection: keep-alive' --data 'courseid=2&userids%5B0%5D=3&wsfunction=core_grades_get_grades&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed Confirm that: The result of that curl call list all your grades in the course including the final course grade, you can format the json using this online tool: jsonlint.com
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46527-master

      Description

      This is a strange error I've found when creating new unit tests for MDL-46460

      If I request to retrieve all the grade items and there is a grade that has both grade and outcome, only the outcome is returned but not the grade

      Note that this prevents to add new unit tests for the core_grades external function

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Frédéric Massart
              Integrator:
              Damyon Wiese
              Tester:
              Damyon Wiese
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14