Skip to content

Commit

Permalink
Remove sequential number from submission slugs
Browse files Browse the repository at this point in the history
That number was causing problems when rolling back and re-executing
the DOWNLOAD stage since the numbering isn't always guaranteed to be
the same (at least with the BypassDownloadStage).

This removes protection against name clashes within a year's
submissions.
  • Loading branch information
T0astBread committed Dec 16, 2020
1 parent 73bc0db commit 65dd10b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main/java/automark/stages/BypassDownloadStage.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ public static List<Submission> run(File workingDir, Properties config) throws Us
String[] submissionDirs = unzipDir1.list();
if (submissionDirs == null)
throw new UserFriendlyException("Failed to list extracted submissions");
for (int i = 0; i < submissionDirs.length; i++) {
String submissionDirName = submissionDirs[i];
for (String submissionDirName : submissionDirs) {
String[] parts = submissionDirName.split("_");

String name = parts[0];
String slug = name.toLowerCase().replaceAll("\\s", "_") + "_" + i;
String slug = name.toLowerCase().replaceAll("\\s", "_");
String email = emails.get(name);

Submission submission = new Submission(slug, name, email, null);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/automark/stages/download/MoodleSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public List<Submission> listSubmissions(String assignmentID) throws IOException,
String slug = studentName
.trim()
.toLowerCase()
.replaceAll("\\s", "_")
+ "_" + i;
.replaceAll("\\s", "_");

submissions.add(new Submission(slug, studentName, studentEmail, fileUrl));
}
Expand Down

0 comments on commit 65dd10b

Please sign in to comment.