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

Implement the check_updates callback in the lesson module

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a lesson with at least one page and one question.
      2. Once you have finished configuring the lesson, calculate your current timestamp.
      3. As student, complete the lesson.
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token in the mobile app service for the student that attempted the lesson:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, courseid, the since parameter (with the timestamp you calculated), the tocheck[0][id] with the lesson cmdi and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=17&tocheck[0][contextlevel]=module&tocheck[0][id]=367&tocheck[0][since]=1479575320&wsfunction=core_course_check_updates&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      7. Check that you receive updates for the module: questionattempts, pagesviewed and timers, if you obtained a grade in the lesson you should receive updates for grades too. The updates include the itemids that are the ids of the records in database updated since the timestamp indicated.
      Show
      Create a lesson with at least one page and one question. Once you have finished configuring the lesson, calculate your current timestamp. As student, complete the lesson. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student that attempted the lesson: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, courseid, the since parameter (with the timestamp you calculated), the tocheck [0] [id] with the lesson cmdi and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=17&tocheck [0] [contextlevel] =module&tocheck [0] [id] =367&tocheck [0] [since] =1479575320&wsfunction=core_course_check_updates&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Check that you receive updates for the module: questionattempts, pagesviewed and timers, if you obtained a grade in the lesson you should receive updates for grades too. The updates include the itemids that are the ids of the records in database updated since the timestamp indicated.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57762-master

      Description

      We need this callback to be able to check for updates in the lesson module

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              David Monllaó
              Tester:
              Jake Dallimore
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17