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

WS core_enrol_get_users_courses is not returning the progress field correctly

XMLWordPrintable

    • MOODLE_35_STABLE
    • MOODLE_35_STABLE
    • Hide
      1. As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features)
      2. Create two new courses:
        • C1 with enablecompletion set to 1 and an overview file added (an image)
        • C2 with enablecompletion disabled
      3. Go to the C1 main page, and via the "Cog" open the "Course completion" option and Enable the "Condition: Course grade" using a required course grade of 50
      4. Create three users U1, U2 and U3
      5. Enrol U1 and U2 as students in C1
      6. Enrol U3 as teacher in C1 and C2
      7. Enrol U1 as student in C2
      8. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      9. Create a Token in the mobile app service for all the users (U1, U2 and U3)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      10. Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours. Replace also the userid to mach U1 one

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_get_users_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&userid=19' --compressed | python -m "json.tool"

      11. After executing the WS check that:
        • You receive all the courses you are enrolled, C1 and C2
        • Progress field is set to false/0 for C1 but NULL for C2
      12. Now, execute again the same CURL request but this time using the teacher token (do not replace the existing userid parameter) and check that:
        • You see the same information than in the previous CURL request
      13. Now, execute the same CURL request but using the U2 token (do not replace the existing userid parameter) and check that
        • You only see C1
        • Progress fields is set to NULL
      Show
      As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features) Create two new courses: C1 with enablecompletion set to 1 and an overview file added (an image) C2 with enablecompletion disabled Go to the C1 main page, and via the "Cog" open the "Course completion" option and Enable the "Condition: Course grade" using a required course grade of 50 Create three users U1, U2 and U3 Enrol U1 and U2 as students in C1 Enrol U3 as teacher in C1 and C2 Enrol U1 as student in C2 Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for all the users (U1, U2 and U3) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours. Replace also the userid to mach U1 one curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_get_users_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&userid=19' --compressed | python -m "json.tool" After executing the WS check that: You receive all the courses you are enrolled, C1 and C2 Progress field is set to false/0 for C1 but NULL for C2 Now, execute again the same CURL request but this time using the teacher token (do not replace the existing userid parameter) and check that: You see the same information than in the previous CURL request Now, execute the same CURL request but using the U2 token (do not replace the existing userid parameter) and check that You only see C1 Progress fields is set to NULL

      It seems that for any user the progress being returned is the current user progress in the course, not the user being requested progress.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 26 minutes
                26m

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