Skip to content

Commit

Permalink
Show error message and hide test cases on judging failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Holmes98 committed Apr 28, 2024
1 parent aac9a03 commit 9e7aa3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/submission/judge_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
10 changes: 7 additions & 3 deletions app/views/submissions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

<%= stylesheet_link_tag "submission" %>

<% if @submission.score == nil %>
<% @judge_data = @submission.judge_data %>
<% if @judge_data.errored? %>
<p>
<b>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.</b>
</p>
<% elsif @submission.score == nil %>
<p>
<b>This submission has not finished judging. Refresh this page in a minute or two to see the submission's score.</b>
</p>
Expand Down Expand Up @@ -46,7 +51,6 @@
<% end %>
</p>

<% @judge_data = @submission.judge_data %>
<% if @judge_data.compiled? %>
<table class="results">
<tbody class="compilation status_<%= @judge_data.compilation.status %>">
Expand Down Expand Up @@ -76,7 +80,7 @@
</table>
<% end %>
<table class="results">
<% if !@judge_data.compiled? || @judge_data.compilation.status == :success %>
<% if !@judge_data.errored? && (!@judge_data.compiled? || @judge_data.compilation.status == :success) %>
<tbody class="headings">
<th class="test_name"></th>
<th>Time</th>
Expand Down

0 comments on commit 9e7aa3e

Please sign in to comment.