diff --git a/app/models/submission.rb b/app/models/submission.rb index d1b6dcda..ed0bf29f 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -149,7 +149,7 @@ def update_test_messages judge_data = self.judge_data return if judge_data.status == :pending # incomplete judge_log - return if judge_data.errored? # judge errored - very bad + return if judge_data.data.has_key?('error') # judge errored - very bad errors = [] warnings = [] diff --git a/app/models/submission/judge_data.rb b/app/models/submission/judge_data.rb index ed8f3c87..78b843f4 100644 --- a/app/models/submission/judge_data.rb +++ b/app/models/submission/judge_data.rb @@ -274,7 +274,7 @@ def initialize(log, test_sets, test_cases, prerequisite_sets = []) end def errored? - data.has_key?('error') + data.has_key?('error') || status == :error end def completed? diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 8ebfaae9..e2719429 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -5,7 +5,12 @@ <%= stylesheet_link_tag "submission" %> -<% if @submission.score == nil %> +<% @judge_data = @submission.judge_data %> +<% if @judge_data.errored? %> +
+ An unexpected error has occurred during judging. Please retry the submission, or contact us at <%= mail_to "nzic@nzoi.org.nz" %> if the error persists. +
+<% elsif @submission.score == nil %>This submission has not finished judging. Refresh this page in a minute or two to see the submission's score.
@@ -46,7 +51,6 @@ <% end %> -<% @judge_data = @submission.judge_data %> <% if @judge_data.compiled? %>Time | diff --git a/app/workers/judge_submission_worker.rb b/app/workers/judge_submission_worker.rb index 238e5973..8d862905 100644 --- a/app/workers/judge_submission_worker.rb +++ b/app/workers/judge_submission_worker.rb @@ -46,7 +46,7 @@ def perform(submission_id) rescue StandardError => e unless self.submission.nil? submission.reload - submission.judge_log = {'error' => {'message' => e.message, 'backtrace' => e.backtrace}}.to_json + submission.judge_log = {'error' => {'message' => e.message, 'backtrace' => e.backtrace}, 'status' => 2}.to_json submission.save end raise
---|