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

    • MOODLE_27_STABLE
    • MOODLE_27_STABLE
    • MDL-46527-master
    • 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

      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

            jleyva Juan Leyva
            jleyva Juan Leyva
            Frédéric Massart Frédéric Massart
            Damyon Wiese Damyon Wiese
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.