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

New Web Service mod_choice_delete_choice_responses

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0
    • 2.9.2
    • Choice
    • MOODLE_29_STABLE
    • MOODLE_30_STABLE
    • MDL-51566-master
    • Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service and the module.

      1. Create a course with a choice activity with multiple possible answers
      2. Set the Allow update option to true
      3. Enrol two users (student and editing teacher) in the course
      4. As the student, complete the choice selection two options
      5. Enable the Mobile service in Site administration ► Plugins ► Web services ► Mobile
      6. Create a Token for the student and teacher:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client as Student
      8. As student delete the responses you submitted (replace the wstoken with your token and the choiceid with the choice instance id).

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

      9. Check in the Moodle web interface that your responses were deleted.
      10. Now, submit again your response (two options again).
      11. Call again the WS but now only deleting one response. To do so, replace the responses in the following call with the answerid you can find in the choice_answers table.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_choice_delete_choice_responses&choiceid=2&responses%5B0%5D=3&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed | python -m "json.tool"

      12. Check in the Moodle web interface that you still see one response.
      13. Call again the WS using invalid response ids, you will get warnings as response
      14. Now, as admin, change the choice configuration and set Allow Update to off/no
      15. Call again the WS, you will get a required capability exception
      16. Now, as admin, change the choice configuration and set Allow Update to on/yes and add a passed time close date
      17. Call again the WS, you will get a new exception because the choice is closed
      18. Now, as admin, change the choice configuration and set Allow Update to off/no
      19. Now, delete the missing response but using the Teacher token, you must be able to delete the response even with the choice closed.
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service and the module. Create a course with a choice activity with multiple possible answers Set the Allow update option to true Enrol two users (student and editing teacher) in the course As the student, complete the choice selection two options Enable the Mobile service in Site administration ► Plugins ► Web services ► Mobile Create a Token for the student and teacher: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client as Student As student delete the responses you submitted (replace the wstoken with your token and the choiceid with the choice instance id). curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_choice_delete_choice_responses&choiceid=2&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed | python -m "json.tool" Check in the Moodle web interface that your responses were deleted. Now, submit again your response (two options again). Call again the WS but now only deleting one response. To do so, replace the responses in the following call with the answerid you can find in the choice_answers table. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_choice_delete_choice_responses&choiceid=2&responses%5B0%5D=3&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed | python -m "json.tool" Check in the Moodle web interface that you still see one response. Call again the WS using invalid response ids, you will get warnings as response Now, as admin, change the choice configuration and set Allow Update to off/no Call again the WS, you will get a required capability exception Now, as admin, change the choice configuration and set Allow Update to on/yes and add a passed time close date Call again the WS, you will get a new exception because the choice is closed Now, as admin, change the choice configuration and set Allow Update to off/no Now, delete the missing response but using the Teacher token, you must be able to delete the response even with the choice closed.

      Web Service for deleting the responses of a give choice

            jleyva Juan Leyva
            jleyva Juan Leyva
            Adrian Greeve Adrian Greeve
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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