Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit a5c1638

Browse files
authored
Merge branch 'master' into cli-context-aleksi
2 parents 5ee2408 + 3aa5568 commit a5c1638

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/main/java/fi/helsinki/cs/tmc/cli/command/CourseInfoCommand.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static fi.helsinki.cs.tmc.cli.io.Color.AnsiColor.ANSI_BLUE;
44
import static fi.helsinki.cs.tmc.cli.io.Color.AnsiColor.ANSI_GREEN;
5+
import static fi.helsinki.cs.tmc.cli.io.Color.AnsiColor.ANSI_PURPLE;
56
import static fi.helsinki.cs.tmc.cli.io.Color.AnsiColor.ANSI_RED;
67

78
import fi.helsinki.cs.tmc.cli.CliContext;
@@ -155,12 +156,18 @@ private void printOneExercise(boolean showAll) {
155156
private void printExerciseShort() {
156157
io.println("Exercise: " + exercise.getName());
157158
io.println("Deadline: " + getDeadline(exercise));
158-
io.println(formatString("completed", exercise.isCompleted()));
159-
if (!exercise.isCompleted() && exercise.isAttempted()) {
160-
io.println(Color.colorString("attempted", ANSI_BLUE));
161-
}
162-
if (exercise.requiresReview()) {
163-
io.println(formatString("reviewed", exercise.isReviewed()));
159+
160+
if (exercise.hasDeadlinePassed() && !exercise.isCompleted()) {
161+
io.println(Color.colorString("deadline passed", ANSI_PURPLE));
162+
} else {
163+
if (!exercise.isCompleted() && exercise.isAttempted()) {
164+
io.println(Color.colorString("attempted", ANSI_BLUE));
165+
} else {
166+
io.println(formatString("completed", exercise.isCompleted()));
167+
}
168+
if (exercise.requiresReview()) {
169+
io.println(formatString("reviewed", exercise.isReviewed()));
170+
}
164171
}
165172
}
166173

src/main/java/fi/helsinki/cs/tmc/cli/command/PasteCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public void run(CommandLine args, Io io) {
9191
CourseInfo info = ctx.getCourseInfo();
9292
Exercise exercise = info.getExercise(exerciseName);
9393
URI uri = TmcUtil.sendPaste(ctx, exercise, message);
94+
if (uri == null && exercise.hasDeadlinePassed()) {
95+
io.println("Unable to send the paste."
96+
+ " The deadline for submitting this exercise has passed");
97+
return;
98+
}
9499
if (uri == null) {
95100
io.println("Unable to send the paste");
96101
return;

0 commit comments

Comments
 (0)