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

core_enrol_get_enrolled_users does not inform lastcourseaccess

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7
    • Component/s: Enrolments
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Check that in the Administration -> Users -> Permissions -> User policies, all the options of the "Hide user fields" settings are not marked
      3. Create a new course
      4. Enrole one user as student to the course
      5. Create a Token in the mobile app service for the user enrolled in the course
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Log in into the Moodle site as the student, and go to the Course (created in step 2) -> Participants page (keep this page open)
      7. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Replace also the course id with the id of the course created in step 2

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

      8. In the WS response, locate the lastcourseaccess time field and copy it
      9. Go to https://www.epochconverter.com/ and using the "Timestamp to Human date" option convert the date to something readable
      10. Compare the relative date with the one indicated in the Course Participants page, they should match
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Check that in the Administration -> Users -> Permissions -> User policies, all the options of the "Hide user fields" settings are not marked Create a new course Enrole one user as student to the course Create a Token in the mobile app service for the user enrolled in the course Click on Site administration ► Plugins ► Web services ► Manage tokens Log in into the Moodle site as the student, and go to the Course (created in step 2) -> Participants page (keep this page open) Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Replace also the course id with the id of the course created in step 2 curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=2&wsfunction=core_enrol_get_enrolled_users&wstoken=3af67232a7596ceb658df4db329e5ad6' --compressed | python -m "json.tool" In the WS response, locate the lastcourseaccess time field and copy it Go to https://www.epochconverter.com/ and using the "Timestamp to Human date" option convert the date to something readable Compare the relative date with the one indicated in the Course Participants page, they should match
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64084-master

      Description

      The core_enrol_get_enrolled_users is used to show course participant list. On the website it informs the user tha last access to the course but it's not avalaible. Instead we have lastaccess field but it's the last access to the platform.

      Both are needed. lastaccess to show online status and lastcourseaccess to show the last access to the course on the list.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

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

                  Time Tracking

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