Skip to content

Commit df33d4e

Browse files
author
Ben Lerner
committed
amend displaying weights, simplify buttons
1 parent 27e585c commit df33d4e

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

app/views/grades/_show_simple_list.html.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@
1414
<p>
1515
<% if cur_reg_staff %>
1616
<span class="pull-right">Points:
17-
<%= to_fixed(t['score'] || 1) %>&nbsp;/&nbsp;<%= to_fixed(t['max-score'] || 1) %></span>
17+
<% if t['score'].present? && t['max_score'].present? %>
18+
<%= to_fixed(t['score']) %>&nbsp;/&nbsp;<%= to_fixed(t['max_score']) %>
19+
<% elsif t['score'].present? || t['weight'].present? %>
20+
<%= to_fixed(t['score'] || t['weight']) %>
21+
<% else %>
22+
<%= to_fixed(1) %>
23+
<% end %>
24+
</span>
1825
<% end %>
1926
<b><%= message %>:</b> <%= t['name'] %>
2027
</p>

app/views/grades/show_SandboxGrader.html.erb

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,42 @@
1717
<h3>
1818
<%= @grading_header %>
1919
<% if cur_reg_staff %>
20-
<% if @grading_output.kind_of?(TapParser) %>
21-
<%= link_to Upload.upload_path_for(@grade.grading_output), class: "btn btn-default" do %>
22-
<i class="glyphicon glyphicon-download-alt"></i> Download raw test output
23-
<% end %>
24-
<%= link_to Upload.upload_path_for(@grade.full_log), class: "btn btn-default" do %>
25-
<i class="glyphicon glyphicon-download-alt"></i> Download full log
26-
<% end %>
27-
28-
<span class="pull-right">Total score:
29-
<%= to_fixed(@grading_output.points_earned) %>&nbsp;/&nbsp;<%= to_fixed(@grading_output.points_available)%>
30-
</span>
31-
<% elsif @grader.response_type == 'simple_list' %>
32-
<%= link_to Upload.upload_path_for(@grade.grading_output), class: "btn btn-default" do %>
33-
<i class="glyphicon glyphicon-download-alt"></i> Download raw test output
34-
<% end %>
35-
<%= link_to Upload.upload_path_for(@grade.orca_result_path), class: "btn btn-default" do %>
36-
<i class="glyphicon glyphicon-download-alt"></i> Download full log
37-
<% end %>
38-
39-
<span class="pull-right">Total score:
40-
<% if @grading_output %>
41-
<%= to_fixed(@grading_output['score']) %>&nbsp;/&nbsp;<%= to_fixed(@grading_output['max-score'])%>
42-
<% else %>
43-
??
44-
</span> <% end %>
45-
20+
<% if @grading_output.kind_of?(TapParser)
21+
raw_test_output = @grade.grading_output
22+
full_log = @grade.full_log
23+
score = @grading_output.points_earned
24+
max_score = @grading_output.points_available
25+
else
26+
raw_test_output = @grade.grading_output
27+
full_log = @grade.orca_result_path
28+
score = @grading_output['score']
29+
max_score = @grading_output['max-score']
30+
end
31+
%>
32+
<% if File.file?(full_log) %>
33+
<div class="btn-group" style="white-space: nowrap;">
34+
<%= link_to Upload.upload_path_for(raw_test_output), class: "btn btn-default" do %>
35+
<i class="glyphicon glyphicon-download-alt"></i> Download raw output
36+
<% end %><button type="button" class="btn btn-md btn-default dropdown-toggle"
37+
data-toggle="dropdown"
38+
aria-haspopup="true" aria-expanded="false">
39+
<span class="caret"></span>
40+
<span class="sr-only">Toggle Dropdown</span>
41+
</button><% #
42+
%><ul class="dropdown-menu">
43+
<li><%= link_to "Download raw output",
44+
Upload.upload_path_for(raw_test_output),
45+
class: "dropdown-item" %></li>
46+
<li><%= link_to "Download full log",
47+
Upload.upload_path_for(full_log),
48+
class: "dropdown-item" %></li>
49+
<!-- <div class="dropdown-divider"></div> -->
50+
</ul>
51+
</div>
4652
<% end %>
53+
<span class="pull-right">Total score:
54+
<%= to_fixed(score) %>&nbsp;/&nbsp;<%= to_fixed(max_score) %>
55+
</span>
4756
<% end %>
4857
</h3>
4958
<% if @grading_output.nil? %>

0 commit comments

Comments
 (0)