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

New Web Service mod_assign_get_submission_status

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.2
    • 3.1
    • Assignment
    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-52924-master
    • Hide
      1. Please note that this issue comes with some refactors in Moodle code core, refactors are minor because is basically moving code to new functions (no changes in the code), in any case testing requires both test the Web version and the WS version of the module.
      2. Create a new course, enrol two students and one teacher. The course should be configured with visible groups, not forced.
      3. Create a new group, enrol the two students there.
      4. Now, create 3 assignment activities:
        1. A1 - Set the group mode to 'None', assignment submission types: check all, feedback types: check all. The teacher must be able to reopen attempts (Attempts reopened setting set to manually). The user can upload up to 2 files.
        2. A2 - Same as A1 but setting the group mode to visible groups, with the setting "Student submit in groups" on and Require all group members submit set to NO
        3. A3 - Same as A2 but with Require all group members submit set to Yes
      5. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for both students and the teacher user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Now, access in the Web Interface to the assignment A1 with one of the students you created the token for and check that the submission status is no attempt and grading status is not graded
      8. Next, you can do a CURL REST call simulating a WS client with one of the student users.
        • You need to replace the wstoken, assignid (with the instance id, not the cmid) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid=32&wsfunction=mod_assign_get_submission_status&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      9. Now, check that in the JSON response you see: "gradingstatus": "notgraded" and "status": "new", "canedit": true and "cansubmit": false (cansubmit is used in combination with draftattemps so a false here is correct)
      10. In the web interface now, do a submission attaching 2 files and text
      11. Check in the web interface that the status is now Submitted for grading and the text and files submitted are displayed
      12. Execute again the CURL request and check that the JSON response match the data displayed in the Web Interface: "status": "submitted", and the text and files submitted are correctly listed in the submission.plugins attribute (some information like the due date and time remaining is not returned because that information can be retrieved using the general mod_assign_get_assignments web service)
      13. Now, as the teacher in the web interface grade the submission: add a grade, some feedback text, a feedback file and set Allow another attempt to Yes
      14. In the web interface check now that you see that the submission was reopened, you see your previous submission including the feedback text, file and grade.
      15. Execute the CURL request and check that:
        • Submission status is reopened
        • lastattempt "gradingstatus": "notgraded",
        • You see now a feedback attribute, with the formatted grade
        • You see now a previousattempts structure, including the previous attempt and the feedback text and files, the grade object and the submission for that attempt data (including files)
      16. Now, as the student in the web interface submit the assignment again
      17. As a teacher, grade and provide feedback for this las attempt, DO NOT set to Yes this time the Allow another attempt field.
      18. Execute the CURL call again and check that now you see in the feedback structure the complete feedback and the grade object.
      19. Execute the same CURL call as a teacher (need to change the token in the curl request to the one you created for the teacher), appending &userid=THE_STUDENT_ID to the curl call, you should see the same information plus a "gradingsummary" structure that matches the same information in the web interface
      20. Now, using the token for the other student run the same CURL command, you should see an exception because that user shouldn't be able to view other user's attempts.
      21. Now, repeat the same steps for A2 and A3, the only differences in that cases is that you should see an additional submission object (teamsubmission) and the submissiongroupmemberswhoneedtosubmit filled only for case A3.
      22. Fetching the data for student 2 should give the same info as student1 for A2/A3 but they should not be able to view the data for student 1.
      Show
      Please note that this issue comes with some refactors in Moodle code core, refactors are minor because is basically moving code to new functions (no changes in the code), in any case testing requires both test the Web version and the WS version of the module. Create a new course, enrol two students and one teacher. The course should be configured with visible groups, not forced. Create a new group, enrol the two students there. Now, create 3 assignment activities: A1 - Set the group mode to 'None', assignment submission types: check all, feedback types: check all. The teacher must be able to reopen attempts (Attempts reopened setting set to manually). The user can upload up to 2 files. A2 - Same as A1 but setting the group mode to visible groups, with the setting "Student submit in groups" on and Require all group members submit set to NO A3 - Same as A2 but with Require all group members submit set to Yes As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for both students and the teacher user: Click on Site administration ► Plugins ► Web services ► Manage tokens Now, access in the Web Interface to the assignment A1 with one of the students you created the token for and check that the submission status is no attempt and grading status is not graded Next, you can do a CURL REST call simulating a WS client with one of the student users. You need to replace the wstoken, assignid (with the instance id, not the cmid) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid=32&wsfunction=mod_assign_get_submission_status&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Now, check that in the JSON response you see: "gradingstatus": "notgraded" and "status": "new", "canedit": true and "cansubmit": false (cansubmit is used in combination with draftattemps so a false here is correct) In the web interface now, do a submission attaching 2 files and text Check in the web interface that the status is now Submitted for grading and the text and files submitted are displayed Execute again the CURL request and check that the JSON response match the data displayed in the Web Interface: "status": "submitted", and the text and files submitted are correctly listed in the submission.plugins attribute (some information like the due date and time remaining is not returned because that information can be retrieved using the general mod_assign_get_assignments web service) Now, as the teacher in the web interface grade the submission: add a grade, some feedback text, a feedback file and set Allow another attempt to Yes In the web interface check now that you see that the submission was reopened, you see your previous submission including the feedback text, file and grade. Execute the CURL request and check that: Submission status is reopened lastattempt "gradingstatus": "notgraded", You see now a feedback attribute, with the formatted grade You see now a previousattempts structure, including the previous attempt and the feedback text and files, the grade object and the submission for that attempt data (including files) Now, as the student in the web interface submit the assignment again As a teacher, grade and provide feedback for this las attempt, DO NOT set to Yes this time the Allow another attempt field. Execute the CURL call again and check that now you see in the feedback structure the complete feedback and the grade object. Execute the same CURL call as a teacher (need to change the token in the curl request to the one you created for the teacher), appending &userid=THE_STUDENT_ID to the curl call, you should see the same information plus a "gradingsummary" structure that matches the same information in the web interface Now, using the token for the other student run the same CURL command, you should see an exception because that user shouldn't be able to view other user's attempts. Now, repeat the same steps for A2 and A3, the only differences in that cases is that you should see an additional submission object (teamsubmission) and the submissiongroupmemberswhoneedtosubmit filled only for case A3. Fetching the data for student 2 should give the same info as student1 for A2/A3 but they should not be able to view the data for student 1.

    Description

      Given an attemptid and userid this web service returns the following information:

      • Grading summary (if the user has permissions)
      • Submission status
      • Feedback received
      • Previous attempts information

      This function return all the information that is displayed in the submission view page in Moodle for a user.

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Mark Nelson Mark Nelson
              David Monllaó David Monllaó
              Andrew Lyons Andrew Lyons
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                23/May/16