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

get_submission_status is missing a groupid parameter to return correctly the grading summary

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.2, 3.3.4, 3.4, 3.5
    • Fix Version/s: 3.5
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as an admin.
      2. Create a new course with the following settings:
        • Group mode: Separate groups
        • Force group mode: Yes
      3. Enrol two users in the course (u1 and u2)
      4. Create two course groups (g1 and g2). Take note of the group ID numbers.
      5. Assign one user to one different group (u1 in g1, u2 in g2)
      6. Enrol one teacher in the course (editing teacher), double check that editing teacher can access all groups.
      7. Create a new assignment activity, take note of its ID. Note: It's not the same as the id parameter indicated in the mod/assign/view.php URL. It's the id indicated in the mdl_assign table.
      8. Configure the created assignment so “Require students click submit button“ (Submission settings section) is set to Yes
      9. Login as u1 and do a submission (but do not click the submit button yet, we are keeping it in draft state)
      10. Logn as admin, go to Site administration.
      11. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      12. Create a Token in the mobile app service for the teacher:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      13. Login as the teacher.
      14. Go to the assignment activity's main page.
      15. Change the value of the "Separate groups" filter to "All participants" and check the "Participants" row in the "Grading summary" table.
        • Confirm that the number reflects the total number of participants in the course. (Note that in some cases if you have a teacher enrolled in the course it will be counted, this is another issue not related to this one)
        • Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser.
        • *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser.
      16. Open a terminal and do a CURL REST call simulating a WS client with the user (Replace the ones enclosed in brackets with the appropriate values):

        curl '[YOUR_MOODLE_WWWROOT]/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid=[ASSIGN_ID]&wsfunction=mod_assign_get_submission_status&wstoken=[TEACHERS_WSTOKEN]&groupid=0' | python -m "json.tool"

        • Confirm that the "gradingsummary->participantcount" matches the "Participants" row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser.
        • *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser.
      17. Login again as u1, go to your draft submission and click the “Submit” button so your submission is submitted
      18. On the browser, change the value of the "Separate groups" filter to "g1" and check the "Participants" row in the "Grading summary" table. Take note of g1's group ID (it is the number indicated in the "group" parameter of the URL).
        • Confirm that the number reflects the total number of g1's members (which is 1).
      19. On the terminal, do another CURL REST call:

        curl '[YOUR_MOODLE_WWWROOT]/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid=[ASSIGN_ID]&wsfunction=mod_assign_get_submission_status&wstoken=[TEACHERS_WSTOKEN]&groupid=[GROUP_1_ID]' | python -m "json.tool"

        • Confirm that the "gradingsummary->participantcount" matches the "Participants" row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser.
        • *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser.
      20. On the browser, change the value of the "Separate groups" filter to "g2" and check the "Participants" row in the "Grading summary" table. Take note of g1's group ID (it is the number indicated in the "group" parameter of the URL).
        • Confirm that the number reflects the total number of g2's members (which is 1).
      21. On the terminal, do another CURL REST call:

        curl '[YOUR_MOODLE_WWWROOT]/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid=[ASSIGN_ID]&wsfunction=mod_assign_get_submission_status&wstoken=[TEACHERS_WSTOKEN]&groupid=[GROUP_2_ID]' | python -m "json.tool"

        • Confirm that the "gradingsummary->participantcount" matches the "Participants" row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser.
        • Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser.
        • *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser.
      22. Login as admin again.
      23. Navigate to "Site administration / Users / Permissions / Define roles"
      24. Now, edit the "editingteacher" role in the course and disable the "moodle/site:accessallgroups" capability. Save the changes.
      25. Add the teacher in the group g1.
      26. On the terminal, repeat the CURL REST call for g1.
        • Confirm that you can see the correct number of participants in g1.
      27. Repeat the CURL REST call for g2.
        • Confirm that you will receive a "notingroup" exception (you are trying to retrieve information from a separate group where the teacher is not a member of).
      28. Repeat the first CURL REST call (groupid=0).
        • Confirm that you get the same results as if you called the CURL REST call for g1 and see the the number of participants for g1.
      Show
      Login as an admin. Create a new course with the following settings: Group mode: Separate groups Force group mode: Yes Enrol two users in the course (u1 and u2) Create two course groups (g1 and g2). Take note of the group ID numbers. Assign one user to one different group (u1 in g1, u2 in g2) Enrol one teacher in the course (editing teacher), double check that editing teacher can access all groups. Create a new assignment activity, take note of its ID. Note: It's not the same as the id parameter indicated in the mod/assign/view.php URL. It's the id indicated in the mdl_assign table. Configure the created assignment so “Require students click submit button“ (Submission settings section) is set to Yes Login as u1 and do a submission (but do not click the submit button yet, we are keeping it in draft state) Logn as admin, go to Site administration. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the teacher: Click on Site administration ► Plugins ► Web services ► Manage tokens Login as the teacher. Go to the assignment activity's main page. Change the value of the " Separate groups " filter to " All participants " and check the "Participants" row in the " Grading summary " table. Confirm that the number reflects the total number of participants in the course. (Note that in some cases if you have a teacher enrolled in the course it will be counted, this is another issue not related to this one) Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser. *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser. Open a terminal and do a CURL REST call simulating a WS client with the user (Replace the ones enclosed in brackets with the appropriate values): curl ' [YOUR_MOODLE_WWWROOT] /webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid= [ASSIGN_ID] &wsfunction=mod_assign_get_submission_status&wstoken= [TEACHERS_WSTOKEN] &groupid=0' | python -m "json.tool" Confirm that the " gradingsummary->participantcount " matches the "Participants" row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser. *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser. Login again as u1, go to your draft submission and click the “Submit” button so your submission is submitted On the browser, change the value of the " Separate groups " filter to " g1 " and check the "Participants" row in the " Grading summary " table. Take note of g1's group ID (it is the number indicated in the " group " parameter of the URL). Confirm that the number reflects the total number of g1's members (which is 1). On the terminal, do another CURL REST call: curl ' [YOUR_MOODLE_WWWROOT] /webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid= [ASSIGN_ID] &wsfunction=mod_assign_get_submission_status&wstoken= [TEACHERS_WSTOKEN] &groupid= [GROUP_1_ID] ' | python -m "json.tool" Confirm that the " gradingsummary->participantcount " matches the "Participants" row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser. *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser. On the browser, change the value of the " Separate groups " filter to " g2 " and check the "Participants" row in the " Grading summary " table. Take note of g1's group ID (it is the number indicated in the " group " parameter of the URL). Confirm that the number reflects the total number of g2's members (which is 1). On the terminal, do another CURL REST call: curl ' [YOUR_MOODLE_WWWROOT] /webservice/rest/server.php?moodlewsrestformat=json' --data 'assignid= [ASSIGN_ID] &wsfunction=mod_assign_get_submission_status&wstoken= [TEACHERS_WSTOKEN] &groupid= [GROUP_2_ID] ' | python -m "json.tool" Confirm that the " gradingsummary->participantcount " matches the "Participants" row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissiondraftscount" matches the “Draft” row's number in the assignment's grading summary page in the browser. Confirm that the "gradingsummary->submissionssubmittedcount" matches the “Submitted” row's number in the assignment's grading summary page in the browser. *Confirm *that the "gradingsummary->submissionsneedgradingcount" matches the “Needs grading” row's number in the assignment's grading summary page in the browser. Login as admin again. Navigate to " Site administration / Users / Permissions / Define roles " Now, edit the "editingteacher" role in the course and disable the " moodle/site:accessallgroups " capability. Save the changes. Add the teacher in the group g1. On the terminal, repeat the CURL REST call for g1. Confirm that you can see the correct number of participants in g1. Repeat the CURL REST call for g2. Confirm that you will receive a "notingroup" exception (you are trying to retrieve information from a separate group where the teacher is not a member of). Repeat the first CURL REST call (groupid=0). Confirm that you get the same results as if you called the CURL REST call for g1 and see the the number of participants for g1.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58711-master

      Description

      Right now, it is returning only the grading summary for the first teacher's group.

        Attachments

        1. all-participants.png
          all-participants.png
          29 kB
        2. curl-results.png
          curl-results.png
          824 kB
        3. group-a only.png
          group-a only.png
          28 kB
        4. group-b only.png
          group-b only.png
          29 kB
        5. MDL-58711_Confirmation Evidence.xlsx
          789 kB
        6. screenshot-1.png
          screenshot-1.png
          27 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/May/18