Skip to content

Commit 153f260

Browse files
committed
Output warning when DOWNLOAD stage completes with zero submissions
1 parent 6555af8 commit 153f260

File tree

1 file changed

+28
-1
lines changed
  • src/main/java/automark/subcommands

1 file changed

+28
-1
lines changed

src/main/java/automark/subcommands/Run.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,29 @@ public static boolean runAndStop(File workingDir, boolean enableInsecureDebugMec
6868
if (stage == Stage.JPLAG || stage == Stage.SUMMARY)
6969
return false;
7070

71+
if (stage == Stage.DOWNLOAD && submissions.size() == 0) {
72+
System.out.println();
73+
System.out.println();
74+
System.out.println("WARNING: No submissions present after DOWNLOAD stage");
75+
System.out.println();
76+
System.out.println("This is usually an indicator that something went wrong.");
77+
System.out.println();
78+
if (usesBypassDownloadStage(config)) {
79+
System.out.println("Check your submissions ZIP file. Are there really no submissions or\n" +
80+
"is it invalid? Don't bother continuing in case there are no\n" +
81+
"submissions. The JPLAG stage won't work without submissions.");
82+
} else {
83+
System.out.println("You might have specified an incorrect moodleBaseURL. The moodleBaseURL\n" +
84+
"config property should be the URL of your Moodle's login page minus\n" +
85+
"the \"/login/index.php\" at the end.");
86+
System.out.println();
87+
System.out.println("If your Moodle does not have a URL like that it's probably\nincompatible with Automark.");
88+
}
89+
System.out.println();
90+
System.out.println();
91+
return false;
92+
}
93+
7194
if (stopAfterOneStage)
7295
return true;
7396
}
@@ -84,7 +107,7 @@ private static List<Submission> runStage(
84107
) throws UserFriendlyException {
85108
switch (stage) {
86109
case DOWNLOAD:
87-
if ("bypass".equals(config.get(Config.DOWNLOAD_STAGE)))
110+
if (usesBypassDownloadStage(config))
88111
return BypassDownloadStage.run(workingDir, config);
89112
else
90113
return MoodleScraperStage.run(workingDir, config);
@@ -108,4 +131,8 @@ private static List<Submission> runStage(
108131
throw new UserFriendlyException("Invalid state: Tried to execute a stage that isn't implemented: " + stage.name());
109132
}
110133
}
134+
135+
private static boolean usesBypassDownloadStage(Properties config) {
136+
return "bypass".equals(config.get(Config.DOWNLOAD_STAGE));
137+
}
111138
}

0 commit comments

Comments
 (0)