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

New Web Service mod_lesson_launch_attempt

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57688-master
    • Hide
      1. In a course create a lesson with at least one content page and one question page.
      2. Enrol one user as student in the course where the lesson is.
      3. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, lessonid (the lesson instance value) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_launch_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      6. Confirm you don't receive any exception
      7. Confirm that in the moodle database, in the lesson_timer table there is a new entry for the lesson with the starttime set to the current time
      8. Now, execute the same curl request but passing as parameter &pageid=X where X is the id of one of the lesson pages (check the lesson_pages table in db to get one)
      9. Confirm that in the lesson_timer table you don't see new entries but you see the existing entry for the lesson with the lessontime set to the current timestamp
      10. Finally, as admin, edit the lesson and as a password as restriction
      11. Execute again the WS passing the password as parameter (&password=X) and check that the lessontime is successfully updated
      Show
      In a course create a lesson with at least one content page and one question page. Enrol one user as student in the course where the lesson is. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, lessonid (the lesson instance value) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_launch_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm you don't receive any exception Confirm that in the moodle database, in the lesson_timer table there is a new entry for the lesson with the starttime set to the current time Now, execute the same curl request but passing as parameter &pageid=X where X is the id of one of the lesson pages (check the lesson_pages table in db to get one) Confirm that in the lesson_timer table you don't see new entries but you see the existing entry for the lesson with the lessontime set to the current timestamp Finally, as admin, edit the lesson and as a password as restriction Execute again the WS passing the password as parameter (&password=X) and check that the lessontime is successfully updated

      Starts or continues an existing lesson attempt (it basically set the user timers to correct values)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            Ryan Wyllie Ryan Wyllie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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