Description:
shows more login/contest info on result page
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r304:a6eab16005af - - 2 files changed: 9 inserted, 1 deleted

@@ -111,25 +111,25
111 else
111 else
112 render :action => 'edit'
112 render :action => 'edit'
113 end
113 end
114 end
114 end
115
115
116 def destroy
116 def destroy
117 User.find(params[:id]).destroy
117 User.find(params[:id]).destroy
118 redirect_to :action => 'list'
118 redirect_to :action => 'list'
119 end
119 end
120
120
121 def user_stat
121 def user_stat
122 @problems = Problem.find_available_problems
122 @problems = Problem.find_available_problems
123 - @users = User.find(:all)
123 + @users = User.find(:all, :include => [:contests, :contest_stat])
124 @scorearray = Array.new
124 @scorearray = Array.new
125 @users.each do |u|
125 @users.each do |u|
126 ustat = Array.new
126 ustat = Array.new
127 ustat[0] = u
127 ustat[0] = u
128 @problems.each do |p|
128 @problems.each do |p|
129 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
129 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
130 if (sub!=nil) and (sub.points!=nil)
130 if (sub!=nil) and (sub.points!=nil)
131 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
131 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
132 else
132 else
133 ustat << [0,false]
133 ustat << [0,false]
134 end
134 end
135 end
135 end
@@ -1,35 +1,43
1 <h1>User grading results</h1>
1 <h1>User grading results</h1>
2
2
3 <table class="info">
3 <table class="info">
4 <tr class="info-head">
4 <tr class="info-head">
5 <th>User</th>
5 <th>User</th>
6 <th>Name</th>
6 <th>Name</th>
7 <th>Activated?</th>
7 <th>Activated?</th>
8 + <th>Logged in</th>
9 + <th>Contest(s)</th>
8 <% @problems.each do |p| %>
10 <% @problems.each do |p| %>
9 <th><%= p.name %></th>
11 <th><%= p.name %></th>
10 <% end %>
12 <% end %>
11 <th>Total</th>
13 <th>Total</th>
12 <th>Passed</th>
14 <th>Passed</th>
13 </tr>
15 </tr>
14 <% counter = 0 %>
16 <% counter = 0 %>
15 <% @scorearray.each do |sc| %>
17 <% @scorearray.each do |sc| %>
16 <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>">
18 <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>">
17 <% total = 0 %>
19 <% total = 0 %>
18 <% num_passed = 0 %>
20 <% num_passed = 0 %>
19 <% sc.each_index do |i| %>
21 <% sc.each_index do |i| %>
20 <% if i==0 %>
22 <% if i==0 %>
21 <td><%= sc[i].login %></td>
23 <td><%= sc[i].login %></td>
22 <td><%= sc[i].full_name %></td>
24 <td><%= sc[i].full_name %></td>
23 <td><%= sc[i].activated %></td>
25 <td><%= sc[i].activated %></td>
26 + <td>
27 + <%= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' %>
28 + </td>
29 + <td>
30 + <%= sc[i].contests.collect {|c| c.name}.join(', ') %>
31 + </td>
24 <% else %>
32 <% else %>
25 <td><%= sc[i][0] %></td>
33 <td><%= sc[i][0] %></td>
26 <% total += sc[i][0] %>
34 <% total += sc[i][0] %>
27 <% num_passed += 1 if sc[i][1] %>
35 <% num_passed += 1 if sc[i][1] %>
28 <% end %>
36 <% end %>
29 <% end %>
37 <% end %>
30 <td><%= total %></td>
38 <td><%= total %></td>
31 <td><%= num_passed %></td>
39 <td><%= num_passed %></td>
32 </tr>
40 </tr>
33 <% counter += 1 %>
41 <% counter += 1 %>
34 <% end %>
42 <% end %>
35 </table>
43 </table>
You need to be logged in to leave comments. Login now