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

WS core_enrol_get_users_courses is not returning the progress field correctly

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:

      Description

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Dani Palou
                Integrator:
                David Monllaó
                Tester:
                Janelle Barcega
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/19

                  Time Tracking

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