Description:
remove junk from ealier merge
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r484:a0c51d75908c - - 1 file changed: 0 inserted, 28 deleted

@@ -108,124 +108,96
108 108 ' were successfully created. ' +
109 109 '( (+) - created with random passwords.)'
110 110 redirect_to :action => 'list'
111 111 end
112 112
113 113 def edit
114 114 @user = User.find(params[:id])
115 115 end
116 116
117 117 def update
118 118 @user = User.find(params[:id])
119 119 if @user.update_attributes(params[:user])
120 120 flash[:notice] = 'User was successfully updated.'
121 121 redirect_to :action => 'show', :id => @user
122 122 else
123 123 render :action => 'edit'
124 124 end
125 125 end
126 126
127 127 def destroy
128 128 User.find(params[:id]).destroy
129 129 redirect_to :action => 'list'
130 130 end
131 131
132 132 def user_stat
133 133 if params[:commit] == 'download csv'
134 134 @problems = Problem.all
135 135 else
136 136 @problems = Problem.find_available_problems
137 137 end
138 138 @users = User.find(:all, :include => [:contests, :contest_stat])
139 139 @scorearray = Array.new
140 140 @users.each do |u|
141 141 ustat = Array.new
142 142 ustat[0] = u
143 143 @problems.each do |p|
144 144 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
145 145 if (sub!=nil) and (sub.points!=nil)
146 146 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
147 147 else
148 148 ustat << [0,false]
149 149 end
150 150 end
151 151 @scorearray << ustat
152 152 end
153 153 end
154 154
155 155 def user_stat_max
156 - @problems = Problem.find_available_problems
157 - @users = User.find(:all, :include => [:contests, :contest_stat])
158 - @scorearray = Array.new
159 - #set up range from param
160 - since_id = params.fetch(:since_id, 0).to_i
161 - until_id = params.fetch(:until_id, 0).to_i
162 - @users.each do |u|
163 - ustat = Array.new
164 - ustat[0] = u
165 - @problems.each do |p|
166 - max_points = 0
167 - Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
168 - max_points = sub.points if sub and sub.points and (sub.points > max_points)
169 - end
170 - ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
171 - end
172 - @scorearray << ustat
173 - end
174 -
175 - if params[:commit] == 'download csv' then
176 - csv = gen_csv_from_scorearray(@scorearray,@problems)
177 - send_data csv, filename: 'last_score.csv'
178 - else
179 - render template: 'user_admin/user_stat'
180 - end
181 - end
182 -
183 - def user_stat_max
184 156 if params[:commit] == 'download csv'
185 157 @problems = Problem.all
186 158 else
187 159 @problems = Problem.find_available_problems
188 160 end
189 161 @users = User.find(:all, :include => [:contests, :contest_stat])
190 162 @scorearray = Array.new
191 163 #set up range from param
192 164 since_id = params.fetch(:since_id, 0).to_i
193 165 until_id = params.fetch(:until_id, 0).to_i
194 166 @users.each do |u|
195 167 ustat = Array.new
196 168 ustat[0] = u
197 169 @problems.each do |p|
198 170 max_points = 0
199 171 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
200 172 max_points = sub.points if sub and sub.points and (sub.points > max_points)
201 173 end
202 174 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
203 175 end
204 176 @scorearray << ustat
205 177 end
206 178
207 179 if params[:commit] == 'download csv' then
208 180 csv = gen_csv_from_scorearray(@scorearray,@problems)
209 181 send_data csv, filename: 'max_score.csv'
210 182 else
211 183 render template: 'user_admin/user_stat'
212 184 end
213 185 end
214 186
215 187 def import
216 188 if params[:file]==''
217 189 flash[:notice] = 'Error importing no file'
218 190 redirect_to :action => 'list' and return
219 191 end
220 192 import_from_file(params[:file])
221 193 end
222 194
223 195 def random_all_passwords
224 196 users = User.find(:all)
225 197 @prefix = params[:prefix] || ''
226 198 @non_admin_users = User.find_non_admin_with_prefix(@prefix)
227 199 @changed = false
228 200 if request.request_method == 'POST'
229 201 @non_admin_users.each do |user|
230 202 password = random_password
231 203 user.password = password
You need to be logged in to leave comments. Login now