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