-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
_review_table.html.erb
82 lines (74 loc) · 3.43 KB
/
_review_table.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<table class="table table-striped grades" class="width: 100%">
<%if ctrl=='review' && @assignment.vary_by_round? %>
<% reviews = reviews.select{|response| response.round == round}.reverse.uniq{|response| response.map_id}.sort_by{|response| response.map_id} %>
<%else%>
<% reviews = reviews.sort_by{|response| response.map_id} %>
<%end%>
<tr><th style="text-align:center;"> </th>
<% for i in 0...reviews.size%>
<th style="text-align:center;"><%= collabel %> <%=i+1%> </th>
<% end %>
</tr>
<% unless controller.action_name == "view_my_scores" && @assignment.is_anonymous?%>
<tr class="head"><td align="right"><b><%= rowlabel %></b></td>
<% for review in reviews %>
<td align="center">
<% unless controller.action_name == "view_my_scores"%>
<%= review.map.reviewer.fullname(session[:ip]) %></a> <%=link_to image_tag("/assets/delete_icon.png", :border => 0), {:controller => 'response', :action => 'delete', :id => review.id, :return => 'instructor'} %>
<% else %>
<%= review.map.reviewer.fullname(session[:ip]) %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
<tr class="head">
<td align="right"><b>Average score</b></td>
<% for review in reviews %>
<td align="center">
<% score = Response.score(:response => [review], :questions => @questions) %>
<% unless controller.action_name == "view_my_scores" %>
<input type="hidden" class="form-control" id="mailer_<%= review.map.reviewer.fullname(session[:ip]) %>_grade" name="mailer[<%= review.map.reviewer.fullname(session[:ip]) %>_grade]" value="<%= score %>">
<% end %>
<%if score==-1%>
<%= sprintf("--") %>%
<%else%>
<%= sprintf("%.2f",score) %>%
<%end%>
</td>
<% end %>
</tr>
<!--Adding code for fetching the reputation -->
<% unless @assignment.reputation_algorithm == '' %>
<tr class="head" id="reputation_row" style="visibility: hidden">
<% if reviews.count > 0 and reviews[0].round == @assignment.rounds_of_reviews %>
<td align="right"><b>Reputation</b> <button class="btn btn-sm btn-default" onclick="hide_reputation()">Hide</button></td>
<% for review in reviews %>
<td align="center">
<% review_participant = Participant.find(review.map.reviewer.id) %>
<% case @assignment.reputation_algorithm %>
<% when 'Lauw' %>
<p id = "reputation_score" class = <%= get_css_style_for_lauw_reputation(review_participant.Lauw)%> style = "width:60px;">
<%= review_participant.Lauw%></p>
<% when 'Hamer' %>
<p id = "reputation_score" class = <%= get_css_style_for_hamer_reputation(review_participant.Hamer)%> style = "width:60px;">
<%= review_participant.Hamer%></p>
<% end %>
</td>
<% end %>
<% end %>
</tr>
<% end %>
</table>
<button class="btn btn-sm btn-default" id="show_button" onclick="show_reputation()">Show Reputation</button>
<script>
function hide_reputation(){
$("#show_button").css("visibility", "visible");
$("#reputation_row").css("visibility", "hidden");
}
function show_reputation(){
$("#show_button").css("visibility", "hidden");
$("#reputation_row").css("visibility", "visible");
}
</script>