-
Bug
-
Resolution: Fixed
-
Minor
-
3.2.4, 3.3.1
-
MOODLE_32_STABLE, MOODLE_33_STABLE
-
MOODLE_32_STABLE, MOODLE_33_STABLE
-
MDL-59893-master -
-
3.4 Sprint 4
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.
- blocks
-
MDL-36985 Assignment activity "Download all submissions" action includes files a student removed from online submission text
-
- Closed
-