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

New Web Service mod_lesson_finish_attempt

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: Lesson, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. In a course create a lesson with at least two content pages. Configure the lesson to display the progress bar.
      2. Enrol one user as student in the course where the lesson is.
      3. Access to the lesson as student in the Moodle web interface, and visit the two pages.
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. 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), p

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

      1. Now check that you don't see any warnings, see the correct progress value (matching the one in the web inteface for the lesson) and you see several information in the "data" field like welldone set to 1, the progresscompleted set to the same value than web and in gradeinfo you see that the lesson didn't have questions.
      Show
      In a course create a lesson with at least two content pages. Configure the lesson to display the progress bar. Enrol one user as student in the course where the lesson is. Access to the lesson as student in the Moodle web interface, and visit the two pages. 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), p curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=4&wsfunction=mod_lesson_finish_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Now check that you don't see any warnings, see the correct progress value (matching the one in the web inteface for the lesson) and you see several information in the "data" field like welldone set to 1, the progresscompleted set to the same value than web and in gradeinfo you see that the lesson didn't have questions.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57724-master

      Description

      Finish an existing attempt, this usually happens when the user reach the lesson EOL page or when the timer is off

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              David Monllaó
              Tester:
              David Monllaó
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

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