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

Assign: assorted bug fixes for the download submissions feature

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test prereqs:

      1. 3 students and 1 teacher enrolled in a course.
      2. 2 groups:
        • Group A containing student 1
        • Group B containing student 2
        • Student 3 is NOT in a group.
      3. 1 Grouping, containing both Group A and B.
      4. 5 image files on your local fs for testing uploads.
      5. An assignment (A1) with:
        • Online text submissions enabled
        • GroupMode set to 'separate groups'
        • Feedback files = true
        • Student submit in groups = yes, and set grouping to the grouping you created.
      6. An assignment (A2) with:
        • Online text submissions enabled
        • GroupMode set to 'separate groups'
        • Feedback files = true
        • Students submit in groups = no

      Test onlinetext file links work after downloading

      For assignment 1:

      1. As student 1, create a submission and upload image 1 and image 4 in the online text area. Submit this.
      2. As student 2, create a submission and upload image 2 and image 5 in the online text area. Submit this.
      3. As student 3, create a submission and upload image 3 in the online text area. Submit this.
      4. As the teacher, on the view all submission page, make sure the checkbox 'Download submissions in folders' is ticked (bottom of page).
      5. Make sure the separate groups select is set to 'All participants'
      6. Select 'Download all submissions' from the grading action select.
      7. Confirm that the filename does not contain any double hyphens (--), nor does it contain the group name.
      8. Extract the resulting zip file and confirm that:
        • You see a folder for each student submission
        • Each student is prefixed with 'Group A', 'Group B' or 'Default group' respectively. Student 3 is listed as 'Default group' because they are not in the grouping - this is normal.
        • Inside each student submission folder you see the 2 corresponding image files and an 'onlinetext.html' file.
        • The image file names are not prefixed with anything.
      9. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works).
      10. Now, uncheck the checkbox 'Download submissions in folders'
      11. Select 'Download all submissions' from the grading action select
      12. Extract the resulting zip file and confirm that:
        • All submission files are prefixed with 'Group A', 'Group B' or 'Default group' respectively.

      For assignment 2:

      1. Repeat the above download steps with 'Download submissions in folders' enabled. Extract the file. This time confirm that:
        • No group prefix is present on the student folder nor on the submission files.
      2. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works).
      3. Repeat the above download steps with 'Download submissions in folders' disabled. Extract the file. This time confirm that:
        • No group prefix is present on any of the the submission files.
      4. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works).

      Feedback files regression test (uploading multiple feedback files in a zip)

      1. For each of the assignments:
        • Set downloadasfolders = true (ticked)
        • Download all submissions with 'all participants' selected and extract files
        • Edit the onlinetext.html for one student and save changes.
        • Select all student submission folders and create a zip
        • Select 'Upload multiple feedback files in a zip' from the 'Grading action' select
        • Pick your newly created zip file and upload
        • Confirm that you see the feedback files for all students and that you can see the modified text for the student submission you modified.
        • Repeat above steps with 'downloadasfolders' set to false (unticked).
        • Repeat above steps but instead of selecting 'all participants', select a specific group.
      Show
      Test prereqs: 3 students and 1 teacher enrolled in a course. 2 groups: Group A containing student 1 Group B containing student 2 Student 3 is NOT in a group. 1 Grouping, containing both Group A and B. 5 image files on your local fs for testing uploads. An assignment (A1) with: Online text submissions enabled GroupMode set to 'separate groups' Feedback files = true Student submit in groups = yes, and set grouping to the grouping you created. An assignment (A2) with: Online text submissions enabled GroupMode set to 'separate groups' Feedback files = true Students submit in groups = no Test onlinetext file links work after downloading For assignment 1: As student 1, create a submission and upload image 1 and image 4 in the online text area. Submit this. As student 2, create a submission and upload image 2 and image 5 in the online text area. Submit this. As student 3, create a submission and upload image 3 in the online text area. Submit this. As the teacher, on the view all submission page, make sure the checkbox 'Download submissions in folders' is ticked (bottom of page). Make sure the separate groups select is set to 'All participants' Select 'Download all submissions' from the grading action select. Confirm that the filename does not contain any double hyphens (--), nor does it contain the group name. Extract the resulting zip file and  confirm that : You see a folder for each student submission Each student is prefixed with 'Group A', 'Group B' or 'Default group' respectively. Student 3 is listed as 'Default group' because they are not in the grouping - this is normal. Inside each student submission folder you see the 2 corresponding image files and an 'onlinetext.html' file. The image file names are not prefixed with anything. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works). Now, uncheck the checkbox 'Download submissions in folders' Select 'Download all submissions' from the grading action select Extract the resulting zip file and  confirm that : All submission files are prefixed with 'Group A', 'Group B' or 'Default group' respectively. For assignment 2: Repeat the above download steps with 'Download submissions in folders' enabled. Extract the file. This time  confirm that: No group prefix is present on the student folder nor on the submission files. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works). Repeat the above download steps with 'Download submissions in folders' disabled. Extract the file. This time  confirm that: No group prefix is present on any of the the submission files. Open the onlinetext.html file for each student and confirm the images are displayed (i.e. confirm the link works). Feedback files regression test (uploading multiple feedback files in a zip) For each of the assignments: Set downloadasfolders = true (ticked) Download all submissions with 'all participants' selected and extract files Edit the onlinetext.html for one student and save changes. Select all student submission folders and create a zip Select 'Upload multiple feedback files in a zip' from the 'Grading action' select Pick your newly created zip file and upload Confirm that  you see the feedback files for all students and that you can see the modified text for the student submission you modified. Repeat above steps with 'downloadasfolders' set to false (unticked). Repeat above steps but instead of selecting 'all participants', select a specific group.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59893-master
    • Sprint:
      3.4 Sprint 4

      Description

      From a comment on MDL-36985, where this code was originally:

      The first commit covers 2 bugs, both related to improper groupname prefixes:

      Bug 1: This occurs with a specific combination of assignment settings:

      i. groupmode = 1 (separate groups) AND;
      ii. teamsubmission = true

      Then, if we download with 'All participants' selected, it tries to generate a per-student prefix for the files/folders in the zip (whether we have files or folders depends on the userpreference 'downloadasfolders'). The code might prefix all the included image files, for example, so it can refer to these using the same prefix in in the <img> tags in onlinetext.html for that student submission.

      Generating the prefix involves getting the activity active group for each student submission, but since we've selected 'all participants' on the download page, this returns 0 for every student in the assignment, regardless of submission group. This then results in a bad prefix being generated by download_rewrite_pluginfile_urls().

      The result is that, once extracted, all submissions appear to have no images, at least when viewing the onlinetext.html file. The images are included alongside the html, but the links are broken. The first commit makes sure the correct submission group is used in download_rewrite_pluginfile_urls().

      Bug 2: This is minor bug with the filename of the generated zip which again occurs when downloading with 'all participants' selected.

      download_submissions() tries to get the activity active group for the file name, which returns 0 and the groupname is set to a single hyphen. I.e. groupname couldn't be found but the prefix is still created. The first commit makes sure the groupname prefix is only set here if the groupid is non-zero, such as when filtering by the group before downloading. If the groupid is zero, then the group component is empty and won't impact the filename.

      The second commit covers 1 bug:

      Bug 3: This again occurs with a specific combination of assignment settings:

      i. groupmode = 1 (separate groups) AND;
      ii. teamsubmission = true

      And with the userpreference 'downloadasfolders' set to true.

      Then, if we download with 'All participants' selected, the resulting zip file should contain a folder for each student submission, with the prefix on the folder and NOT on the files within the folder. What happens though, is that download_rewrite_pluginfile_urls() isn't aware of this user preference, and simply prefixes the link urls regardless, meaning the links point to files that don't exist. The second commit fixes this bug.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jaked Jake Dallimore
                Reporter:
                jaked Jake Dallimore
                Peer reviewer:
                John Okely
                Integrator:
                Andrew Nicols
                Tester:
                Mark Nelson
                Participants:
                Component watchers:
                Damyon Wiese, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Matteo Scaramuccia, Jake Dallimore, Jun Pataleta
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17