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

Web Service core_enrol_get_users_courses is missing hidden, starred and course completion courses information

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.6
    • 3.5.2
    • Course
    • MOODLE_35_STABLE
    • MOODLE_36_STABLE
    • MDL-63739-master
    • Hide
      1. As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features)
      2. Create two new courses, C1 and C2
      3. * C1 with enablecompletion set to 1
      4. 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
      5. Create two users U1 and U2
      6. Enrol U1 as students in C1 and C2
      7. Enrol U2 as teacher in C1 and C2
      8. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      9. Create a Token in the mobile app service for all the users
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      10. As U1 access the Moodle web interface, in the dashboard using the three dots menu at each course, "Hide from view" course C1 and "Star course C2"
      11. 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"

      12. After executing the WS check that:
        • You receive all the courses you are enrolled, C1 and C2
        • C1 field isfavourite is set to false
        • C1 field hidden is set to true
        • C1 field completionhascriteria is set to true
        • C2 field isfavourite is set to true
        • C2 field hidden is set to false
        • C2 field completionhascriteria is set to false
      13. Now, execute the same CURL request but using the U2 token (keeping the original userid) and check that
        • C1 field isfavourite is set to false
        • C1 field hidden is set to false
        • C1 field completionhascriteria is set to true
        • C2 field isfavourite is set to false
        • C2 field hidden is set to false
        • C2 field completionhascriteria is set to false
      Show
      As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features) Create two new courses, C1 and C2 * C1 with enablecompletion set to 1 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 two users U1 and U2 Enrol U1 as students in C1 and C2 Enrol U2 as teacher in C1 and C2 Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for all the users Click on Site administration ► Plugins ► Web services ► Manage tokens As U1 access the Moodle web interface, in the dashboard using the three dots menu at each course, "Hide from view" course C1 and "Star course C2" 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 C1 field isfavourite is set to false C1 field hidden is set to true C1 field completionhascriteria is set to true C2 field isfavourite is set to true C2 field hidden is set to false C2 field completionhascriteria is set to false Now, execute the same CURL request but using the U2 token (keeping the original userid) and check that C1 field isfavourite is set to false C1 field hidden is set to false C1 field completionhascriteria is set to true C2 field isfavourite is set to false C2 field hidden is set to false C2 field completionhascriteria is set to false

      MDL-63522 was created to support all the new fields for building the users dashboard but is missing the hidden and starred courses information (probably because it was developed before hidden courses were supported).

      Also, even returning enablecompletion and progress and completed field we are not able to know if course completion is set, we need to return if the course has completions set. (via $info->get_completions($USER->id);
      )

            jleyva Juan Leyva
            jleyva Juan Leyva
            Albert Gasset Albert Gasset
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

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