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

New Web Service mod_workshop_update_submission

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.4
    • Component/s: Workshop
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course with a workshop
      2. Enrol a couple of users as student in that course (student1 and student2)
      3. All the required information in the workshop to switch to the submisson phase
      4. As the student1, do a submission
      5. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for student1:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the student1.
        • You need to replace the wstoken with the student1 one, submissionid (the submission to be updated id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'submissionid=12&wsfunction=mod_workshop_update_submission&title=mytitle&content=thecontent2&contentformat=1&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      8. Check that the returned data includes a field status set to true
      9. Now, execute the same curl request but leaving the parameter title empty. You should get an exception "the param title is invalid"
      10. Now, in the moodle web site create another submission but using the student2 account
      11. Execute again the first curl request (using the new created submission id but not changing the rest of parameters)
      12. You should get another exception because you are trying to change a submission you didn't do
      13. Now, as teacher switch to the assessment phase (doing the student allocation)
      14. Repeat the first curl request, you should get an exception because you are now in the assessment phase so you can't edit your submissions anymore
      Show
      Create a course with a workshop Enrol a couple of users as student in that course (student1 and student2) All the required information in the workshop to switch to the submisson phase As the student1, do a submission Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for student1: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student1. You need to replace the wstoken with the student1 one, submissionid (the submission to be updated id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'submissionid=12&wsfunction=mod_workshop_update_submission&title=mytitle&content=thecontent2&contentformat=1&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Check that the returned data includes a field status set to true Now, execute the same curl request but leaving the parameter title empty. You should get an exception "the param title is invalid" Now, in the moodle web site create another submission but using the student2 account Execute again the first curl request (using the new created submission id but not changing the rest of parameters) You should get another exception because you are trying to change a submission you didn't do Now, as teacher switch to the assessment phase (doing the student allocation) Repeat the first curl request, you should get an exception because you are now in the assessment phase so you can't edit your submissions anymore
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59245-master

      Description

      To update an existing submission

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17