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

New Web Service mod_workshop_add_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 (leave all the workshop default settings and do not switch phases)
      2. Enrol a couple of users as teacher and student in that course
      3. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token in the mobile app service for the student in the course:
        • 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.
        • You need to replace the wstoken with the student one, workshopid (workshop instance id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'workshopid=6&wsfunction=mod_workshop_add_submission&title=theTitle&content=thecontent&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      6. Check that the returned response is an exception with error code nopermissions: The reason is that the submission phase is not yet configured
      7. Now, as teacher, switch to the submission phase (adding the missing required data in the first phase)
      8. Execute the same curl request and check that the response is now a submissionid (that is the id of the submission created) including a field status set to true
      9. Now, execute the same curl request again, you should receive as response status = false and a warning in the warnings array indicating that there was already created a submission
      10. As user, access to the Moodle web interface and check that the submission was correctly created for the student in the workshop.
      11. Delete your own submission (as teacher you can delete it)
      12. Do a new submission but using the web-interface (attaching files in both the content text editor and in the attachment field)
      13. Check that the submission is correctly created and delete it again.
      14. Execute the last curl request again but leaving empty the title field
      15. You should get a errorinvalidparam exception
      16. Now, as teacher in the web interface configure the workshop adding a Submissions deadline (a month ago)
      17. Execute the last curl request but adding someting in the title field and check that you get a nopermissions errorcode again
      Show
      Create a course with a workshop (leave all the workshop default settings and do not switch phases) Enrol a couple of users as teacher and student in that course Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student. You need to replace the wstoken with the student one, workshopid (workshop instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'workshopid=6&wsfunction=mod_workshop_add_submission&title=theTitle&content=thecontent&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Check that the returned response is an exception with error code nopermissions: The reason is that the submission phase is not yet configured Now, as teacher, switch to the submission phase (adding the missing required data in the first phase) Execute the same curl request and check that the response is now a submissionid (that is the id of the submission created) including a field status set to true Now, execute the same curl request again, you should receive as response status = false and a warning in the warnings array indicating that there was already created a submission As user, access to the Moodle web interface and check that the submission was correctly created for the student in the workshop. Delete your own submission (as teacher you can delete it) Do a new submission but using the web-interface (attaching files in both the content text editor and in the attachment field) Check that the submission is correctly created and delete it again. Execute the last curl request again but leaving empty the title field You should get a errorinvalidparam exception Now, as teacher in the web interface configure the workshop adding a Submissions deadline (a month ago) Execute the last curl request but adding someting in the title field and check that you get a nopermissions errorcode again
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59243-master

      Description

      To add a new submission

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Mark Nelson
              Integrator:
              Jun Pataleta
              Tester:
              Andrew Nicols
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

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