Description:
- update show max score
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r594:ad5ce58ac280 - - 4 files changed: 71 inserted, 19 deleted
new file 100644 |
@@ -1,241 +1,250 | |||||
|
1 | class ReportController < ApplicationController |
|
1 | class ReportController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck, :cheat_report, :cheat_scruntinize] |
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck, :cheat_report, :cheat_scruntinize] |
|
4 |
|
4 | ||
|
5 | before_filter(only: [:problem_hof]) { |c| |
|
5 | before_filter(only: [:problem_hof]) { |c| |
|
6 | return false unless authenticate |
|
6 | return false unless authenticate |
|
7 |
|
7 | ||
|
8 | if GraderConfiguration["right.user_view_submission"] |
|
8 | if GraderConfiguration["right.user_view_submission"] |
|
9 | return true; |
|
9 | return true; |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | admin_authorization |
|
12 | admin_authorization |
|
13 | } |
|
13 | } |
|
14 |
|
14 | ||
|
15 |
- def |
|
15 | + def max_score |
|
16 | end |
|
16 | end |
|
17 |
|
17 | ||
|
18 |
- def |
|
18 | + def show_max_score |
|
19 | - #process list of problems |
|
19 | + #process parameters |
|
|
20 | + #problems | ||
|
|
21 | + @problems = [] | ||
|
|
22 | + params[:problem_id].each do |id| | ||
|
|
23 | + next unless id.strip != "" | ||
|
|
24 | + @problems << Problem.find(id.to_i) | ||
|
|
25 | + end | ||
|
20 |
|
26 | ||
|
21 | - #process submission range |
|
27 | + #users |
|
22 | - if params[:commit] == 'download csv' |
|
28 | + @users = if params[:user] == "all" then |
|
23 | - @problems = Problem.all |
|
29 | + User.find(:all, :include => [:contests, :contest_stat]) |
|
24 | - else |
|
30 | + else |
|
25 | - @problems = Problem.find_available_problems |
|
31 | + User.includes(:contests).includes(:contest_stat).where(enabled: true) |
|
26 | - end |
|
32 | + end |
|
27 | - @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
33 | + |
|
|
34 | + #set up range from param | ||
|
|
35 | + since_id = params.fetch(:min_id, 0).to_i | ||
|
|
36 | + until_id = params.fetch(:max_id, 0).to_i | ||
|
|
37 | + | ||
|
|
38 | + #get data | ||
|
28 | @scorearray = Array.new |
|
39 | @scorearray = Array.new |
|
29 | - #set up range from param |
|
||
|
30 | - since_id = params.fetch(:since_id, 0).to_i |
|
||
|
31 | - until_id = params.fetch(:until_id, 0).to_i |
|
||
|
32 | @users.each do |u| |
|
40 | @users.each do |u| |
|
33 | ustat = Array.new |
|
41 | ustat = Array.new |
|
34 | ustat[0] = u |
|
42 | ustat[0] = u |
|
35 | @problems.each do |p| |
|
43 | @problems.each do |p| |
|
36 | max_points = 0 |
|
44 | max_points = 0 |
|
37 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
45 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
38 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
46 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
39 | end |
|
47 | end |
|
40 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
48 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
41 | end |
|
49 | end |
|
42 | @scorearray << ustat |
|
50 | @scorearray << ustat |
|
43 | end |
|
51 | end |
|
44 |
|
52 | ||
|
45 | if params[:commit] == 'download csv' then |
|
53 | if params[:commit] == 'download csv' then |
|
46 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
54 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
47 | send_data csv, filename: 'max_score.csv' |
|
55 | send_data csv, filename: 'max_score.csv' |
|
48 | else |
|
56 | else |
|
49 | - render template: 'user_admin/user_stat' |
|
57 | + #render template: 'user_admin/user_stat' |
|
|
58 | + render 'max_score' | ||
|
50 | end |
|
59 | end |
|
51 |
|
60 | ||
|
52 | end |
|
61 | end |
|
53 |
|
62 | ||
|
54 | def score |
|
63 | def score |
|
55 | if params[:commit] == 'download csv' |
|
64 | if params[:commit] == 'download csv' |
|
56 | @problems = Problem.all |
|
65 | @problems = Problem.all |
|
57 | else |
|
66 | else |
|
58 | @problems = Problem.find_available_problems |
|
67 | @problems = Problem.find_available_problems |
|
59 | end |
|
68 | end |
|
60 | @users = User.includes(:contests, :contest_stat).where(enabled: true) #find(:all, :include => [:contests, :contest_stat]).where(enabled: true) |
|
69 | @users = User.includes(:contests, :contest_stat).where(enabled: true) #find(:all, :include => [:contests, :contest_stat]).where(enabled: true) |
|
61 | @scorearray = Array.new |
|
70 | @scorearray = Array.new |
|
62 | @users.each do |u| |
|
71 | @users.each do |u| |
|
63 | ustat = Array.new |
|
72 | ustat = Array.new |
|
64 | ustat[0] = u |
|
73 | ustat[0] = u |
|
65 | @problems.each do |p| |
|
74 | @problems.each do |p| |
|
66 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
75 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
67 | if (sub!=nil) and (sub.points!=nil) and p and p.full_score |
|
76 | if (sub!=nil) and (sub.points!=nil) and p and p.full_score |
|
68 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
77 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
69 | else |
|
78 | else |
|
70 | ustat << [0,false] |
|
79 | ustat << [0,false] |
|
71 | end |
|
80 | end |
|
72 | end |
|
81 | end |
|
73 | @scorearray << ustat |
|
82 | @scorearray << ustat |
|
74 | end |
|
83 | end |
|
75 | if params[:commit] == 'download csv' then |
|
84 | if params[:commit] == 'download csv' then |
|
76 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
85 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
77 | send_data csv, filename: 'last_score.csv' |
|
86 | send_data csv, filename: 'last_score.csv' |
|
78 | else |
|
87 | else |
|
79 | render template: 'user_admin/user_stat' |
|
88 | render template: 'user_admin/user_stat' |
|
80 | end |
|
89 | end |
|
81 |
|
90 | ||
|
82 | end |
|
91 | end |
|
83 |
|
92 | ||
|
84 | def login_stat |
|
93 | def login_stat |
|
85 | @logins = Array.new |
|
94 | @logins = Array.new |
|
86 |
|
95 | ||
|
87 | date_and_time = '%Y-%m-%d %H:%M' |
|
96 | date_and_time = '%Y-%m-%d %H:%M' |
|
88 | begin |
|
97 | begin |
|
89 | md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
98 | md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
90 | @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i) |
|
99 | @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i) |
|
91 | rescue |
|
100 | rescue |
|
92 | @since_time = DateTime.new(1000,1,1) |
|
101 | @since_time = DateTime.new(1000,1,1) |
|
93 | end |
|
102 | end |
|
94 | begin |
|
103 | begin |
|
95 | md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
104 | md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
96 | @until_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i) |
|
105 | @until_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i) |
|
97 | rescue |
|
106 | rescue |
|
98 | @until_time = DateTime.new(3000,1,1) |
|
107 | @until_time = DateTime.new(3000,1,1) |
|
99 | end |
|
108 | end |
|
100 |
|
109 | ||
|
101 | User.all.each do |user| |
|
110 | User.all.each do |user| |
|
102 | @logins << { id: user.id, |
|
111 | @logins << { id: user.id, |
|
103 | login: user.login, |
|
112 | login: user.login, |
|
104 | full_name: user.full_name, |
|
113 | full_name: user.full_name, |
|
105 | count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
114 | count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
106 | user.id,@since_time,@until_time) |
|
115 | user.id,@since_time,@until_time) |
|
107 | .count(:id), |
|
116 | .count(:id), |
|
108 | min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
117 | min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
109 | user.id,@since_time,@until_time) |
|
118 | user.id,@since_time,@until_time) |
|
110 | .minimum(:created_at), |
|
119 | .minimum(:created_at), |
|
111 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
120 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
112 | user.id,@since_time,@until_time) |
|
121 | user.id,@since_time,@until_time) |
|
113 | .maximum(:created_at), |
|
122 | .maximum(:created_at), |
|
114 | ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
123 | ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
115 | user.id,@since_time,@until_time) |
|
124 | user.id,@since_time,@until_time) |
|
116 | .select(:ip_address).uniq |
|
125 | .select(:ip_address).uniq |
|
117 |
|
126 | ||
|
118 | } |
|
127 | } |
|
119 | end |
|
128 | end |
|
120 | end |
|
129 | end |
|
121 |
|
130 | ||
|
122 | def submission_stat |
|
131 | def submission_stat |
|
123 |
|
132 | ||
|
124 | date_and_time = '%Y-%m-%d %H:%M' |
|
133 | date_and_time = '%Y-%m-%d %H:%M' |
|
125 | begin |
|
134 | begin |
|
126 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
135 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
127 | rescue |
|
136 | rescue |
|
128 | @since_time = DateTime.new(1000,1,1) |
|
137 | @since_time = DateTime.new(1000,1,1) |
|
129 | end |
|
138 | end |
|
130 | begin |
|
139 | begin |
|
131 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
140 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
132 | rescue |
|
141 | rescue |
|
133 | @until_time = DateTime.new(3000,1,1) |
|
142 | @until_time = DateTime.new(3000,1,1) |
|
134 | end |
|
143 | end |
|
135 |
|
144 | ||
|
136 | @submissions = {} |
|
145 | @submissions = {} |
|
137 |
|
146 | ||
|
138 | User.find_each do |user| |
|
147 | User.find_each do |user| |
|
139 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
148 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
140 | end |
|
149 | end |
|
141 |
|
150 | ||
|
142 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
151 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
143 | if @submissions[s.user_id] |
|
152 | if @submissions[s.user_id] |
|
144 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
153 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
145 | a = Problem.find_by_id(s.problem_id) |
|
154 | a = Problem.find_by_id(s.problem_id) |
|
146 | @submissions[s.user_id][:sub][s.problem_id] = |
|
155 | @submissions[s.user_id][:sub][s.problem_id] = |
|
147 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
156 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
148 | sub_ids: [s.id] } |
|
157 | sub_ids: [s.id] } |
|
149 | else |
|
158 | else |
|
150 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
159 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
151 | end |
|
160 | end |
|
152 | @submissions[s.user_id][:count] += 1 |
|
161 | @submissions[s.user_id][:count] += 1 |
|
153 | end |
|
162 | end |
|
154 | end |
|
163 | end |
|
155 | end |
|
164 | end |
|
156 |
|
165 | ||
|
157 | def problem_hof |
|
166 | def problem_hof |
|
158 | # gen problem list |
|
167 | # gen problem list |
|
159 | @user = User.find(session[:user_id]) |
|
168 | @user = User.find(session[:user_id]) |
|
160 | @problems = @user.available_problems |
|
169 | @problems = @user.available_problems |
|
161 |
|
170 | ||
|
162 | # get selected problems or the default |
|
171 | # get selected problems or the default |
|
163 | if params[:id] |
|
172 | if params[:id] |
|
164 | begin |
|
173 | begin |
|
165 | @problem = Problem.available.find(params[:id]) |
|
174 | @problem = Problem.available.find(params[:id]) |
|
166 | rescue |
|
175 | rescue |
|
167 | redirect_to action: :problem_hof |
|
176 | redirect_to action: :problem_hof |
|
168 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
177 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
169 | return |
|
178 | return |
|
170 | end |
|
179 | end |
|
171 | end |
|
180 | end |
|
172 |
|
181 | ||
|
173 | return unless @problem |
|
182 | return unless @problem |
|
174 |
|
183 | ||
|
175 | @by_lang = {} #aggregrate by language |
|
184 | @by_lang = {} #aggregrate by language |
|
176 |
|
185 | ||
|
177 | range =65 |
|
186 | range =65 |
|
178 | @histogram = { data: Array.new(range,0), summary: {} } |
|
187 | @histogram = { data: Array.new(range,0), summary: {} } |
|
179 | @summary = {count: 0, solve: 0, attempt: 0} |
|
188 | @summary = {count: 0, solve: 0, attempt: 0} |
|
180 | user = Hash.new(0) |
|
189 | user = Hash.new(0) |
|
181 | Submission.where(problem_id: @problem.id).find_each do |sub| |
|
190 | Submission.where(problem_id: @problem.id).find_each do |sub| |
|
182 | #histogram |
|
191 | #histogram |
|
183 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
192 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
184 | @histogram[:data][d.to_i] += 1 if d < range |
|
193 | @histogram[:data][d.to_i] += 1 if d < range |
|
185 |
|
194 | ||
|
186 | next unless sub.points |
|
195 | next unless sub.points |
|
187 | @summary[:count] += 1 |
|
196 | @summary[:count] += 1 |
|
188 | user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max |
|
197 | user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max |
|
189 |
|
198 | ||
|
190 | lang = Language.find_by_id(sub.language_id) |
|
199 | lang = Language.find_by_id(sub.language_id) |
|
191 | next unless lang |
|
200 | next unless lang |
|
192 | next unless sub.points >= @problem.full_score |
|
201 | next unless sub.points >= @problem.full_score |
|
193 |
|
202 | ||
|
194 | #initialize |
|
203 | #initialize |
|
195 | unless @by_lang.has_key?(lang.pretty_name) |
|
204 | unless @by_lang.has_key?(lang.pretty_name) |
|
196 | @by_lang[lang.pretty_name] = { |
|
205 | @by_lang[lang.pretty_name] = { |
|
197 | runtime: { avail: false, value: 2**30-1 }, |
|
206 | runtime: { avail: false, value: 2**30-1 }, |
|
198 | memory: { avail: false, value: 2**30-1 }, |
|
207 | memory: { avail: false, value: 2**30-1 }, |
|
199 | length: { avail: false, value: 2**30-1 }, |
|
208 | length: { avail: false, value: 2**30-1 }, |
|
200 | first: { avail: false, value: DateTime.new(3000,1,1) } |
|
209 | first: { avail: false, value: DateTime.new(3000,1,1) } |
|
201 | } |
|
210 | } |
|
202 | end |
|
211 | end |
|
203 |
|
212 | ||
|
204 | if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
213 | if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
205 | @by_lang[lang.pretty_name][:runtime] = { avail: true, user_id: sub.user_id, value: sub.max_runtime, sub_id: sub.id } |
|
214 | @by_lang[lang.pretty_name][:runtime] = { avail: true, user_id: sub.user_id, value: sub.max_runtime, sub_id: sub.id } |
|
206 | end |
|
215 | end |
|
207 |
|
216 | ||
|
208 | if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
217 | if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
209 | @by_lang[lang.pretty_name][:memory] = { avail: true, user_id: sub.user_id, value: sub.peak_memory, sub_id: sub.id } |
|
218 | @by_lang[lang.pretty_name][:memory] = { avail: true, user_id: sub.user_id, value: sub.peak_memory, sub_id: sub.id } |
|
210 | end |
|
219 | end |
|
211 |
|
220 | ||
|
212 | if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
221 | if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
213 | !sub.user.admin? |
|
222 | !sub.user.admin? |
|
214 | @by_lang[lang.pretty_name][:first] = { avail: true, user_id: sub.user_id, value: sub.submitted_at, sub_id: sub.id } |
|
223 | @by_lang[lang.pretty_name][:first] = { avail: true, user_id: sub.user_id, value: sub.submitted_at, sub_id: sub.id } |
|
215 | end |
|
224 | end |
|
216 |
|
225 | ||
|
217 | if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
226 | if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
218 | @by_lang[lang.pretty_name][:length] = { avail: true, user_id: sub.user_id, value: sub.effective_code_length, sub_id: sub.id } |
|
227 | @by_lang[lang.pretty_name][:length] = { avail: true, user_id: sub.user_id, value: sub.effective_code_length, sub_id: sub.id } |
|
219 | end |
|
228 | end |
|
220 | end |
|
229 | end |
|
221 |
|
230 | ||
|
222 | #process user_id |
|
231 | #process user_id |
|
223 | @by_lang.each do |lang,prop| |
|
232 | @by_lang.each do |lang,prop| |
|
224 | prop.each do |k,v| |
|
233 | prop.each do |k,v| |
|
225 | v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
234 | v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
226 | end |
|
235 | end |
|
227 | end |
|
236 | end |
|
228 |
|
237 | ||
|
229 | #sum into best |
|
238 | #sum into best |
|
230 | if @by_lang and @by_lang.first |
|
239 | if @by_lang and @by_lang.first |
|
231 | @best = @by_lang.first[1].clone |
|
240 | @best = @by_lang.first[1].clone |
|
232 | @by_lang.each do |lang,prop| |
|
241 | @by_lang.each do |lang,prop| |
|
233 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
242 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
234 | @best[:runtime] = prop[:runtime] |
|
243 | @best[:runtime] = prop[:runtime] |
|
235 | @best[:runtime][:lang] = lang |
|
244 | @best[:runtime][:lang] = lang |
|
236 | end |
|
245 | end |
|
237 | if @best[:memory][:value] >= prop[:memory][:value] |
|
246 | if @best[:memory][:value] >= prop[:memory][:value] |
|
238 | @best[:memory] = prop[:memory] |
|
247 | @best[:memory] = prop[:memory] |
|
239 | @best[:memory][:lang] = lang |
|
248 | @best[:memory][:lang] = lang |
|
240 | end |
|
249 | end |
|
241 | if @best[:length][:value] >= prop[:length][:value] |
|
250 | if @best[:length][:value] >= prop[:length][:value] |
@@ -1,43 +1,85 | |||||
|
1 | %h1 Maximum score |
|
1 | %h1 Maximum score |
|
2 |
|
2 | ||
|
3 | - = form_tag report_max_score_path |
|
3 | + = form_tag report_show_max_score_path |
|
4 | .row |
|
4 | .row |
|
5 | .col-md-4 |
|
5 | .col-md-4 |
|
6 | .panel.panel-primary |
|
6 | .panel.panel-primary |
|
7 | .panel-heading |
|
7 | .panel-heading |
|
8 | Problems |
|
8 | Problems |
|
9 | .panel-body |
|
9 | .panel-body |
|
10 | - = label_tag :problems, "Problems" |
|
10 | + %p |
|
11 | - = select 'problems', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + Problem.all.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control' } |
|
11 | + Select problem(s) that we wish to know the score. |
|
|
12 | + = label_tag :problem_id, "Problems" | ||
|
|
13 | + = select_tag 'problem_id[]', | ||
|
|
14 | + options_for_select(Problem.all.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}), | ||
|
|
15 | + { class: 'select2 form-control', multiple: "true" } | ||
|
12 | .col-md-4 |
|
16 | .col-md-4 |
|
13 | .panel.panel-primary |
|
17 | .panel.panel-primary |
|
14 | .panel-heading |
|
18 | .panel-heading |
|
15 | Submission range |
|
19 | Submission range |
|
16 | .panel-body |
|
20 | .panel-body |
|
|
21 | + %p | ||
|
|
22 | + Input minimum and maximum range of submission ID that should be included. A blank value for min and max means -1 and infinity, respectively. | ||
|
17 | .form-group |
|
23 | .form-group |
|
18 |
- = label_tag :from, " |
|
24 | + = label_tag :from, "Min" |
|
19 | = text_field_tag 'from_id', nil, class: "form-control" |
|
25 | = text_field_tag 'from_id', nil, class: "form-control" |
|
20 | .form-group |
|
26 | .form-group |
|
21 |
- = label_tag :from, " |
|
27 | + = label_tag :from, "Max" |
|
22 | = text_field_tag 'to_id', nil, class: "form-control" |
|
28 | = text_field_tag 'to_id', nil, class: "form-control" |
|
23 | .col-md-4 |
|
29 | .col-md-4 |
|
24 | .panel.panel-primary |
|
30 | .panel.panel-primary |
|
25 | .panel-heading |
|
31 | .panel-heading |
|
26 | Users |
|
32 | Users |
|
27 | .panel-body |
|
33 | .panel-body |
|
28 | .radio |
|
34 | .radio |
|
29 | %label |
|
35 | %label |
|
30 | = radio_button_tag 'users', 'all', true |
|
36 | = radio_button_tag 'users', 'all', true |
|
31 | All users |
|
37 | All users |
|
32 | .radio |
|
38 | .radio |
|
33 | %label |
|
39 | %label |
|
34 | = radio_button_tag 'users', 'enabled' |
|
40 | = radio_button_tag 'users', 'enabled' |
|
35 | Only enabled users |
|
41 | Only enabled users |
|
36 | .row |
|
42 | .row |
|
37 | .col-md-12 |
|
43 | .col-md-12 |
|
38 | = button_tag 'Show', class: "btn btn-primary btn-large" |
|
44 | = button_tag 'Show', class: "btn btn-primary btn-large" |
|
39 | = button_tag 'Download CSV', class: "btn btn-primary btn-large" |
|
45 | = button_tag 'Download CSV', class: "btn btn-primary btn-large" |
|
|
46 | + | ||
|
|
47 | + - if @scorearray | ||
|
|
48 | + %h2 Result | ||
|
|
49 | + %table.table.sortable.table-striped.table-bordered.table-condensed | ||
|
|
50 | + %thead | ||
|
|
51 | + %tr | ||
|
|
52 | + %th Login | ||
|
|
53 | + %th Name | ||
|
|
54 | + %th Activated? | ||
|
|
55 | + %th Logged_in | ||
|
|
56 | + %th Contest(s) | ||
|
|
57 | + %th Remark | ||
|
|
58 | + - @problems.each do |p| | ||
|
|
59 | + %th.text-right= p.name | ||
|
|
60 | + %th.text-right Total | ||
|
|
61 | + %th.text-right Passed | ||
|
|
62 | + %tbody | ||
|
|
63 | + - @scorearray.each do |sc| | ||
|
|
64 | + %tr | ||
|
|
65 | + - total,num_passed = 0,0 | ||
|
|
66 | + - sc.each_index do |i| | ||
|
|
67 | + - if i == 0 | ||
|
|
68 | + %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i] | ||
|
|
69 | + %td= sc[i].full_name | ||
|
|
70 | + %td= sc[i].activated | ||
|
|
71 | + %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no' | ||
|
|
72 | + %td= sc[i].contests.collect {|c| c.name}.join(', ') | ||
|
|
73 | + %td= sc[i].remark | ||
|
|
74 | + - else | ||
|
|
75 | + %td.text-right= sc[i][0] | ||
|
|
76 | + - total += sc[i][0] | ||
|
|
77 | + - num_passed += 1 if sc[i][1] | ||
|
|
78 | + %td.text-right= total | ||
|
|
79 | + %td.text-right= num_passed | ||
|
|
80 | + :javascript | ||
|
|
81 | + $.bootstrapSortable(true,'reversed') | ||
|
40 | /.col-md-4.col-md-offset-1 |
|
82 | /.col-md-4.col-md-offset-1 |
|
41 | / = button_tag 'Show', class: "btn btn-primary btn-block" |
|
83 | / = button_tag 'Show', class: "btn btn-primary btn-block" |
|
42 | /.col-md-4.col-md-offset-2 |
|
84 | /.col-md-4.col-md-offset-2 |
|
43 | / = button_tag 'Download CSV', class: "btn btn-primary btn-block" |
|
85 | / = button_tag 'Download CSV', class: "btn btn-primary btn-block" |
@@ -1,67 +1,68 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | get "sources/direct_edit" |
|
2 | get "sources/direct_edit" |
|
3 |
|
3 | ||
|
4 | root :to => 'main#login' |
|
4 | root :to => 'main#login' |
|
5 |
|
5 | ||
|
6 | resources :contests |
|
6 | resources :contests |
|
7 |
|
7 | ||
|
8 | resources :sites |
|
8 | resources :sites |
|
9 |
|
9 | ||
|
10 | resources :announcements do |
|
10 | resources :announcements do |
|
11 | member do |
|
11 | member do |
|
12 | get 'toggle','toggle_front' |
|
12 | get 'toggle','toggle_front' |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
|
15 |
|
15 | ||
|
16 | resources :problems do |
|
16 | resources :problems do |
|
17 | member do |
|
17 | member do |
|
18 | get 'toggle' |
|
18 | get 'toggle' |
|
19 | get 'toggle_test' |
|
19 | get 'toggle_test' |
|
20 | end |
|
20 | end |
|
21 | collection do |
|
21 | collection do |
|
22 | get 'turn_all_off' |
|
22 | get 'turn_all_off' |
|
23 | get 'turn_all_on' |
|
23 | get 'turn_all_on' |
|
24 | get 'import' |
|
24 | get 'import' |
|
25 | get 'manage' |
|
25 | get 'manage' |
|
26 | end |
|
26 | end |
|
27 | end |
|
27 | end |
|
28 |
|
28 | ||
|
29 | resources :grader_configuration, controller: 'configurations' |
|
29 | resources :grader_configuration, controller: 'configurations' |
|
30 |
|
30 | ||
|
31 | resources :users do |
|
31 | resources :users do |
|
32 | member do |
|
32 | member do |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
34 | end |
|
34 | end |
|
35 | end |
|
35 | end |
|
36 |
|
36 | ||
|
37 | #source code edit |
|
37 | #source code edit |
|
38 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
38 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
39 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
39 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
40 | get 'sources/get_latest_submission_status/:uid/:pid', to: 'sources#get_latest_submission_status', as: 'get_latest_submission_status' |
|
40 | get 'sources/get_latest_submission_status/:uid/:pid', to: 'sources#get_latest_submission_status', as: 'get_latest_submission_status' |
|
41 |
|
41 | ||
|
42 |
|
42 | ||
|
43 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
43 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
44 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
44 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
45 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
45 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
46 |
|
46 | ||
|
47 | #main |
|
47 | #main |
|
48 | get "main/list" |
|
48 | get "main/list" |
|
49 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
49 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
50 |
|
50 | ||
|
51 | #report |
|
51 | #report |
|
52 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
52 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
53 | get "report/login" |
|
53 | get "report/login" |
|
54 | get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
54 | get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
|
55 | + post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score' | ||
|
55 |
|
56 | ||
|
56 | #grader |
|
57 | #grader |
|
57 | get 'graders/list', to: 'graders#list', as: 'grader_list' |
|
58 | get 'graders/list', to: 'graders#list', as: 'grader_list' |
|
58 |
|
59 | ||
|
59 |
|
60 | ||
|
60 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
61 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
61 |
|
62 | ||
|
62 | # See how all your routes lay out with "rake routes" |
|
63 | # See how all your routes lay out with "rake routes" |
|
63 |
|
64 | ||
|
64 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
65 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
65 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
66 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
66 | match ':controller(/:action(/:id))(.:format)' |
|
67 | match ':controller(/:action(/:id))(.:format)' |
|
67 | end |
|
68 | end |
You need to be logged in to leave comments.
Login now