Description:
fix download score in user_stat not working
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r499:1da8597120e1 - - 1 file changed: 6 inserted, 0 deleted
@@ -141,24 +141,30 | |||||
|
141 | ustat = Array.new |
|
141 | ustat = Array.new |
|
142 | ustat[0] = u |
|
142 | ustat[0] = u |
|
143 | @problems.each do |p| |
|
143 | @problems.each do |p| |
|
144 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
144 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
145 | if (sub!=nil) and (sub.points!=nil) |
|
145 | if (sub!=nil) and (sub.points!=nil) |
|
146 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
146 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
147 | else |
|
147 | else |
|
148 | ustat << [0,false] |
|
148 | ustat << [0,false] |
|
149 | end |
|
149 | end |
|
150 | end |
|
150 | end |
|
151 | @scorearray << ustat |
|
151 | @scorearray << ustat |
|
152 | end |
|
152 | end |
|
|
153 | + if params[:commit] == 'download csv' then | ||
|
|
154 | + csv = gen_csv_from_scorearray(@scorearray,@problems) | ||
|
|
155 | + send_data csv, filename: 'last_score.csv' | ||
|
|
156 | + else | ||
|
|
157 | + render template: 'user_admin/user_stat' | ||
|
|
158 | + end | ||
|
153 | end |
|
159 | end |
|
154 |
|
160 | ||
|
155 | def user_stat_max |
|
161 | def user_stat_max |
|
156 | if params[:commit] == 'download csv' |
|
162 | if params[:commit] == 'download csv' |
|
157 | @problems = Problem.all |
|
163 | @problems = Problem.all |
|
158 | else |
|
164 | else |
|
159 | @problems = Problem.find_available_problems |
|
165 | @problems = Problem.find_available_problems |
|
160 | end |
|
166 | end |
|
161 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
167 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
162 | @scorearray = Array.new |
|
168 | @scorearray = Array.new |
|
163 | #set up range from param |
|
169 | #set up range from param |
|
164 | since_id = params.fetch(:since_id, 0).to_i |
|
170 | since_id = params.fetch(:since_id, 0).to_i |
You need to be logged in to leave comments.
Login now