Skip to content

Commit

Permalink
New version, add support for submission result status "hidden"
Browse files Browse the repository at this point in the history
  • Loading branch information
Redande committed May 9, 2019
1 parent 7f38474 commit 0e81867
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<target name="-check-mavenmodules">
<uptodate property="mavenmodules.uptodate"
srcfile="maven-wrapper/target/nbm/maven-wrapper-1.29.nbm"
srcfile="maven-wrapper/target/nbm/maven-wrapper-1.30.nbm"
targetfile="mavenmodules"/>
</target>

Expand Down
4 changes: 2 additions & 2 deletions maven-wrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>fi.helsinki.cs.tmc</groupId>
<artifactId>maven-wrapper</artifactId>
<version>1.29</version>
<version>1.30</version>
<packaging>nbm</packaging>

<name>TMC Maven Wrapper</name>
Expand Down Expand Up @@ -46,7 +46,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>core</artifactId>
<version>0.10.11-SNAPSHOT</version>
<version>0.10.13-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
3 changes: 0 additions & 3 deletions nbproject/platform.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
branding.token=tmcbeans
cluster.path=\
${nbplatform.active.dir}/cnd:\
${nbplatform.active.dir}/extide:\
${nbplatform.active.dir}/dlight:\
${nbplatform.active.dir}/harness:\
${nbplatform.active.dir}/ide:\
${nbplatform.active.dir}/java:\
${nbplatform.active.dir}/javafx:\
${nbplatform.active.dir}/nb:\
${nbplatform.active.dir}/platform:\
${nbplatform.active.dir}/webcommon:\
${nbplatform.active.dir}/websvccommon:\
mavenmodules
disabled.modules=\
Expand Down
2 changes: 1 addition & 1 deletion tmc-plugin/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ OpenIDE-Module-Requires:
org.openide.windows.IOProvider,
org.openide.windows.WindowManager
OpenIDE-Module-Install: fi/helsinki/cs/tmc/actions/TmcModuleInstall.class
OpenIDE-Module-Specification-Version: 1.2.4
OpenIDE-Module-Specification-Version: 1.2.5
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void bgTaskReady(SubmissionResult result) {
// as we might have unlocked new exercises.
exercise.setAttempted(true);

if (result.getStatus() == SubmissionResult.Status.OK) {
if (result.getStatus() == SubmissionResult.Status.OK || result.getStatus() == SubmissionResult.Status.HIDDEN) {
exercise.setCompleted(true);
}

Expand Down
54 changes: 26 additions & 28 deletions tmc-plugin/src/fi/helsinki/cs/tmc/ui/TestResultDisplayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
import fi.helsinki.cs.tmc.langs.domain.RunResult;

import com.google.common.collect.ImmutableList;
import fi.helsinki.cs.tmc.core.domain.ProgressObserver;

import java.awt.Dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.URI;
Expand Down Expand Up @@ -68,38 +66,38 @@ public void showSubmissionResult(Exercise exercise, SubmissionResult result, fin
clearTestCaseView();
displayError(result.getError());
break;
case HIDDEN:
dialogs.displayMessage("Submission received and saved.\nResults are hidden for this exercise.");
break;
}
}

private void displaySuccessfulSubmissionMsg(Exercise exercise, final SubmissionResult result) {
final SuccessfulSubmissionDialog dialog = new SuccessfulSubmissionDialog(exercise, result);

dialog.addOkListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
List<FeedbackAnswer> answers = dialog.getFeedbackAnswers();
if (!answers.isEmpty()) {
Callable<String> task = new TmcServerCommunicationTaskFactory().getFeedbackAnsweringJob(URI.create(result.getFeedbackAnswerUrl()), answers);
BgTask.start("Sending feedback", task, new BgTaskListener<String>() {
@Override
public void bgTaskReady(String result) {
}

@Override
public void bgTaskCancelled() {
}

@Override
public void bgTaskFailed(Throwable ex) {
String msg = "Failed to send feedback :-(\n" + ex.getMessage();
String msgWithBacktrace = msg + "\n" + ExceptionUtils.backtraceToString(ex);
log.log(Level.INFO, msgWithBacktrace);
SwingUtilities.invokeLater(() -> {
dialogs.displayError(msg);
});
}
});
}
dialog.addOkListener((ActionEvent e) -> {
List<FeedbackAnswer> answers = dialog.getFeedbackAnswers();
if (!answers.isEmpty()) {
Callable<String> task = new TmcServerCommunicationTaskFactory().getFeedbackAnsweringJob(URI.create(result.getFeedbackAnswerUrl()), answers);
BgTask.start("Sending feedback", task, new BgTaskListener<String>() {
@Override
public void bgTaskReady(String result) {
}

@Override
public void bgTaskCancelled() {
}

@Override
public void bgTaskFailed(Throwable ex) {
String msg = "Failed to send feedback :-(\n" + ex.getMessage();
String msgWithBacktrace = msg + "\n" + ExceptionUtils.backtraceToString(ex);
log.log(Level.INFO, msgWithBacktrace);
SwingUtilities.invokeLater(() -> {
dialogs.displayError(msg);
});
}
});
}
});

Expand Down

0 comments on commit 0e81867

Please sign in to comment.