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

Return if the user is being tracked by completion in core_enrol_get_users_courses

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.3
    • Fix Version/s: 3.7
    • Component/s: Enrolments
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features)
      2. Create one course C1
      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
      7. Enrol U2 as teacher in C1
      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. 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 the course you are enrolled: C1
        • C1 field completionusesrtracked is set to true
      12. Now, execute the same CURL request but using the U2 token (keeping the original userid) and check that
        • C1 field completionusesrtracked is set to false
      Show
      As admin set the global enablecompletion setting to enabled (in Site administration > Advanced features) Create one course C1 * 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 Enrol U2 as teacher in C1 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 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 the course you are enrolled: C1 C1 field completionusesrtracked is set to true Now, execute the same CURL request but using the U2 token (keeping the original userid) and check that C1 field completionusesrtracked is set to false
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65211-master

      Description

      This information will be used to:

      • Hide the completion bar (as fixed in MDL-64898 vi $completion->is_tracked_user($userid))
      • Do not display the completion menu option inside a course

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 25 minutes
                  25m