Download All Assignment Submissions

Download All Assignment Submissions

by Daniel Zimmerman -
Number of replies: 9
In Moodle 1.9x, I would often download an entire assignment's worth of submissions by 1) going to the course files area and zipping up the appropriate folder in "moddata", 2) moving the zipped file to the top level of the course files area, and 3) downloading and unzipping the file. When doing so, I would get a file hierarchy with odd numbering, but the actual submitted assignments - with their original filenames and modification dates - would all be in there. In Moodle 2.0, it seems as though there is now a "Download all assignments as a zip" link on every assignment page... but when I try it on a course that was migrated in from 1.9x, I get a zip file with only the submitted files, with all the names munged (by adding the students' full names, and apparently random numbers at the end before the file extension), and without correct modification dates. Is this an artifact of the course having been migrated in from 1.9x? Would I get better results with a course newly created in 2.0? I ask because I actually need the submitted files to have their original names (otherwise, they won't compile/work with grading scripts), and having their modification dates is also important. Ideally, I'd get a folder hierarchy similar to the one I got under the old system... Any ideas?
Average of ratings: -
In reply to Daniel Zimmerman

Re: Download All Assignment Submissions

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

those "seemingly random" ids at the end before the ext are actually the "id" field from the user table - so you can match up the exact user that relates to this particular submission - we don't use usernames in the filenames as this is "private" data that shoudn't be disclosed by moodle. It renames the file by adding the users fullname to the beginning of the file as the should help to make the filenames unique - otherwise 2 students might submit the file "assignment1" - adding the userid at the end before the file ext means we can eventually create a function that allows a teacher to upload a package of files after reviewing the changes instead of uploading one at a time. Unfortunately this means the filedates will change in the newly packaged file. I don't think there's a way around this except by modifying the packaged zip to include an "info" file - which could be an xml/csv that contains the upload date of the files from the users and any extra information that an external grading system might require.

In any case - your external grading scripts will need a rewrite.

good luck!

In reply to Dan Marsden

Re: Download All Assignment Submissions

by Daniel Zimmerman -
If you could explain how a teacher could possibly rewrite automated grading scripts to automatically de-munge the files, given that they have no access to the Moodle database to match id numbers to usernames (which are _not_ private in our installation, as they are - quite intentionally - the students' public email addresses, which match their usernames on the system, which match their home directories, which match their code repositories, etc.), it would be helpful. Previously, students were required to include their username in their submission filename, which enabled automated grading to work. Now, there's seemingly nothing at all they - or I - can do to enable automated grading, and no way for a teacher to predict what a filename will look like. Perhaps this isn't important for writing assignments, but it's very important for programming assignments, where one might actually want to compile, run, uncompress, etc. the file submitted by the student without having to rename it by hand. It's nice that there's now functionality to reduce the likelihood of filename collisions - but they were already impossible the way I was previously doing things because of the per-user subdirectories in the file area. The fact that the modification dates for the files also somehow have to change in order to package up a zip also completely baffles me, because it's not as though we can't control those programmatically... So the summary here, as far as I understand it, is: what was once utterly trivial to accomplish by making a zip out of a directory tree is now completely impossible to accomplish in the new Moodle file management structure. Correct?
In reply to Daniel Zimmerman

Re: Download All Assignment Submissions

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Wow - you seem rather upset....

you can still require your students to include the username in the filename - Moodle includes the original filename in the submission - it just doesn't automatically add the username as "Moodle" treats the username as "private" - you mention "automated grading" - presumably someone needed to write this tool in the first place - you can't expect Moodle to work with this tool during upgrades...espeicially major upgrades! - you will need to pay/bribe/convince someone to help to rewrite your tool - there are a range of different ways to make it work - by modifying Moodle to suit your needs or modify your grading tool.

If you have some funding you could throw at your problem there are a range of Moodle Partners that could help... (or you could turn it into a Student programming project) smile

Good luck!

In reply to Dan Marsden

Re: Download All Assignment Submissions

by Daniel Zimmerman -
Not upset, just annoyed. Honestly more (far more) annoyed about the unnecessary file modification date changes, because there's simply no easy way to get that information out of Moodle - the filenames can be dealt with fairly easily as long as Moodle preserves the original filenames in a predictable way.

The automated grading script is a fairly simple shell script, which will now have to become a somewhat less simple one, but that's fine... I certainly don't need to pay somebody to help me rewrite it. The main problem now is that I will have to manually look at all the submission dates on Moodle, as they can no longer be dealt with programmatically at all. This seems like something that could in fact be fixed on the Moodle side, as there should really be no need to change those dates when zipping up the files.

Moreover, the particular way the filenames are munged is somewhat odd, since extra stuff is added both at the beginning and in the middle (which is why I didn't recognize the original filenames at first glance). It seems like it would make more sense to add all the extra stuff at the beginning, thereby preserving the entire submitted filename (including its extension, which is part of the filename) as a unit at the end that could be easily de-munged. As it is now, one has to chop off the user's full name from the beginning, then go to where the extension is, backtrack over the ID number, and chop that out of the middle; an inordinate amount of processing when one could instead have a distinctive sequence of characters (two or three underscores, for instance, or something similarly unlikely to occur in a user-submitted filename) separating the Moodle-added part of the filename from the user-submitted part of the filename, which could be easily grepped for and acted on accordingly.
Average of ratings: Useful (1)
In reply to Daniel Zimmerman

Re: Download All Assignment Submissions

by thulasi raman -
Hi, I am using moodle 2.0.1 and I am the non-editing teacher for a course having 60 students. After students have submitted their assignments, when I try to download all the assignments using the "Download all assignments as a zip" button, after download I see that only 40 assignments have been downloaded. What is the reason for this and what is the solution to this?
In reply to thulasi raman

Re: Download All Assignment Submissions

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

are you using group mode in the course? - is it only downloading the files from the group selected?

In reply to Dan Marsden

Re: Download All Assignment Submissions

by thulasi raman -

I am not using any group mode - I want to download the assignments for all the students enrolled in the course.

I want to know if this is a limitation of moodle that all the assignments are not getting downloaded or is there any other solution to this.

In reply to thulasi raman

Re: Download All Assignment Submissions

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

shouldn't be a limitation there  - I've just had another quick look at the code and can't see any limitations on submissions. Can't help much further sorry!

In reply to Dan Marsden

Re: Download All Assignment Submissions

by Leulseged Assefa -

Dan,

I've similar kind of problem.  One of the teachers is asking me if there is a way to append other user fields, other than student's FN and LN, to the file name when using down all option?