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

New Web Service mod_workshop_get_submissions

    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 and one user as teacher
      3. As teacher, move the workshop to the submission phase (doing all the required configuration steps indicated by the activity)
      4. As the two students, do a submission (total of 2 submissions, one per sstudent). Add attachments and images in the editor to the submission.
      5. As admin: enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for one of the students and the teacher:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the student you created the token for.
        • You need to replace the wstoken with the student one, userid 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=8&userid=138&wsfunction=mod_workshop_get_submissions&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      8. Now check that you receive the information of the submission the student did including the files you attached in both the editor as an attachment.
      9. Replace the userid with the other student if in the course.
      10. Execute the curl request and check that you don't receive anything (you don't have permission to see other user submissions at this point)
      11. Now, remove the userid field and replace the wstoken with the teacher one
      12. Execurte the curl request and check that you receive a total of two submissions (each one belonging to a different student)
      13. Add the page and perpage parameters (page = 0 and perpage = 1) and check that you receive the first submission but the totalcount is still 2
      14. Replace page with 1 and check that you receive the second submission
      15. Switch to the assessment phase and check again that as both student and teacher you see the submissions you should see (students their own and teachers all)
      Show
      Create a course with a workshop Enrol a couple of users as student and one user as teacher As teacher, move the workshop to the submission phase (doing all the required configuration steps indicated by the activity) As the two students, do a submission (total of 2 submissions, one per sstudent). Add attachments and images in the editor to the submission. As admin: enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one of the students and the teacher: 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 created the token for. You need to replace the wstoken with the student one, userid 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=8&userid=138&wsfunction=mod_workshop_get_submissions&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Now check that you receive the information of the submission the student did including the files you attached in both the editor as an attachment. Replace the userid with the other student if in the course. Execute the curl request and check that you don't receive anything (you don't have permission to see other user submissions at this point) Now, remove the userid field and replace the wstoken with the teacher one Execurte the curl request and check that you receive a total of two submissions (each one belonging to a different student) Add the page and perpage parameters (page = 0 and perpage = 1) and check that you receive the first submission but the totalcount is still 2 Replace page with 1 and check that you receive the second submission Switch to the assessment phase and check again that as both student and teacher you see the submissions you should see (students their own and teachers all)
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59241-master

      Description

      To retrieve all the existing submissions in a workshop (or the specified user one)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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