Description:
shows scores only for submitted problems
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r386:aef66acd0ee0 - - 2 files changed: 5 inserted, 1 deleted
@@ -112,49 +112,49 | |||
|
112 | 112 | flash[:notice] = 'User was successfully updated.' |
|
113 | 113 | redirect_to :action => 'show', :id => @user |
|
114 | 114 | else |
|
115 | 115 | render :action => 'edit' |
|
116 | 116 | end |
|
117 | 117 | end |
|
118 | 118 | |
|
119 | 119 | def destroy |
|
120 | 120 | User.find(params[:id]).destroy |
|
121 | 121 | redirect_to :action => 'list' |
|
122 | 122 | end |
|
123 | 123 | |
|
124 | 124 | def user_stat |
|
125 | 125 | @problems = Problem.find_available_problems |
|
126 | 126 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
127 | 127 | @scorearray = Array.new |
|
128 | 128 | @users.each do |u| |
|
129 | 129 | ustat = Array.new |
|
130 | 130 | ustat[0] = u |
|
131 | 131 | @problems.each do |p| |
|
132 | 132 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
133 | 133 | if (sub!=nil) and (sub.points!=nil) |
|
134 | 134 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
135 | 135 | else |
|
136 |
- ustat << [ |
|
|
136 | + ustat << [nil,false] | |
|
137 | 137 | end |
|
138 | 138 | end |
|
139 | 139 | @scorearray << ustat |
|
140 | 140 | end |
|
141 | 141 | end |
|
142 | 142 | |
|
143 | 143 | def user_stat_max |
|
144 | 144 | @problems = Problem.find_available_problems |
|
145 | 145 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
146 | 146 | @scorearray = Array.new |
|
147 | 147 | #set up range from param |
|
148 | 148 | since_id = params.fetch(:since_id, 0).to_i |
|
149 | 149 | until_id = params.fetch(:until_id, 0).to_i |
|
150 | 150 | @users.each do |u| |
|
151 | 151 | ustat = Array.new |
|
152 | 152 | ustat[0] = u |
|
153 | 153 | @problems.each do |p| |
|
154 | 154 | max_points = 0 |
|
155 | 155 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
156 | 156 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
157 | 157 | end |
|
158 | 158 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
159 | 159 | end |
|
160 | 160 | @scorearray << ustat |
@@ -14,35 +14,39 | |||
|
14 | 14 | <th>Contest(s)</th> |
|
15 | 15 | <% @problems.each do |p| %> |
|
16 | 16 | <th><%= p.name %></th> |
|
17 | 17 | <% end %> |
|
18 | 18 | <th>Total</th> |
|
19 | 19 | <th>Passed</th> |
|
20 | 20 | </tr> |
|
21 | 21 | <% counter = 0 %> |
|
22 | 22 | <% @scorearray.each do |sc| %> |
|
23 | 23 | <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>"> |
|
24 | 24 | <% total = 0 %> |
|
25 | 25 | <% num_passed = 0 %> |
|
26 | 26 | <% sc.each_index do |i| %> |
|
27 | 27 | <% if i==0 %> |
|
28 | 28 | <td><%= sc[i].login %></td> |
|
29 | 29 | <td><%= sc[i].full_name %></td> |
|
30 | 30 | <td><%= sc[i].activated %></td> |
|
31 | 31 | <td> |
|
32 | 32 | <%= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' %> |
|
33 | 33 | </td> |
|
34 | 34 | <td> |
|
35 | 35 | <%= sc[i].contests.collect {|c| c.name}.join(', ') %> |
|
36 | 36 | </td> |
|
37 | 37 |
<% else %> |
|
38 | + <% if sc[i][0] != nil %> | |
|
38 | 39 | <td><%= sc[i][0] %></td> |
|
39 | 40 | <% total += sc[i][0] %> |
|
40 | 41 | <% num_passed += 1 if sc[i][1] %> |
|
42 | + <% else %> | |
|
43 | + <td>-</td> | |
|
44 | + <% end %> | |
|
41 | 45 | <% end %> |
|
42 | 46 | <% end %> |
|
43 | 47 | <td><%= total %></td> |
|
44 | 48 | <td><%= num_passed %></td> |
|
45 | 49 | </tr> |
|
46 | 50 | <% counter += 1 %> |
|
47 | 51 | <% end %> |
|
48 | 52 | </table> |
You need to be logged in to leave comments.
Login now