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

Implement the check_updates callback in the lesson module

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.2
    • 3.3
    • Lesson
    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57762-master
    • 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.

    Description

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

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Dani Palou Dani Palou
              David Monllaó David Monllaó
              Jake Dallimore Jake Dallimore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/May/17