Description:
merge
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r514:41d1cd2793ff - - 11 files changed: 301 inserted, 132 deleted
@@ -0,0 +1,44 | |||||
|
|
1 | + - param = {} unless param | ||
|
|
2 | + - graph_height = param[:graph_height] || 100 | ||
|
|
3 | + - bar_width = param[:bar_width] || 14 | ||
|
|
4 | + - graph_width = (bar_width * histogram[:data].count) + 20 | ||
|
|
5 | + :css | ||
|
|
6 | + .hist_bar { | ||
|
|
7 | + width: #{bar_width-1}px; | ||
|
|
8 | + position: absolute; | ||
|
|
9 | + background-color: lightblue; | ||
|
|
10 | + } | ||
|
|
11 | + .hist_fill { | ||
|
|
12 | + width: #{bar_width-1}px; | ||
|
|
13 | + position: absolute; | ||
|
|
14 | + background-color: #eee; | ||
|
|
15 | + } | ||
|
|
16 | + .hist_text { | ||
|
|
17 | + position: absolute; | ||
|
|
18 | + font-size:5px; | ||
|
|
19 | + } | ||
|
|
20 | + | ||
|
|
21 | + %div{style: "position: relative; width: #{graph_width}px; height: 125px; background-color:#fff;" } | ||
|
|
22 | + //draw background | ||
|
|
23 | + - histogram[:data].each_index do |i| | ||
|
|
24 | + - height = histogram[:data][i] * graph_height / histogram[:summary][:max] | ||
|
|
25 | + - top = graph_height - height | ||
|
|
26 | + - left = graph_width - (i+1)*bar_width | ||
|
|
27 | + %div.hist_fill{style: "top: 0px; height: #{graph_height - height}px; left: #{left}px;" } | ||
|
|
28 | + // draw horizontal line | ||
|
|
29 | + - line = 3 | ||
|
|
30 | + - line.times do |i| | ||
|
|
31 | + - top = graph_height - graph_height * (i+0.5)/ line | ||
|
|
32 | + %div{style: "position:absolute;width: #{graph_width-21}px;height: 1px;left: 20px;top:#{top}px;background-color: #333;"} | ||
|
|
33 | + %div.hist_text{style: "position:absolute;left: 0px;top:#{top-6}px"} | ||
|
|
34 | + =((i+0.5) * histogram[:summary][:max] / line).to_i | ||
|
|
35 | + // draw the actual bar and text | ||
|
|
36 | + - @histogram[:data].each_index do |i| | ||
|
|
37 | + - height = histogram[:data][i] * graph_height / histogram[:summary][:max] | ||
|
|
38 | + - top = graph_height - height | ||
|
|
39 | + - left = graph_width - (i+1)*bar_width | ||
|
|
40 | + %div.hist_bar{style: "top: #{top}px; height: #{height}px; left: #{left}px; dae: #{histogram[:data][i]}" } | ||
|
|
41 | + - if i % 7 == 1 | ||
|
|
42 | + %div.hist_text{style: "top:#{graph_height + 5}px;left: #{left}px;"} #{(Time.zone.today - i.day).strftime('%-d')} | ||
|
|
43 | + - if (Time.now.in_time_zone - i.day).day == 15 | ||
|
|
44 | + %div.hist_text{style: "top:#{graph_height + 15}px;left: #{left}px;"} #{(Time.zone.today - i.day).strftime('%b')} |
@@ -150,11 +150,25 | |||||
|
150 |
|
150 | ||
|
151 | def stat |
|
151 | def stat |
|
152 | @problem = Problem.find(params[:id]) |
|
152 | @problem = Problem.find(params[:id]) |
|
153 |
- |
|
153 | + unless @problem.available or session[:admin] |
|
154 | redirect_to :controller => 'main', :action => 'list' |
|
154 | redirect_to :controller => 'main', :action => 'list' |
|
155 | - else |
|
155 | + return |
|
156 | - @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id) |
|
||
|
157 | end |
|
156 | end |
|
|
157 | + @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id) | ||
|
|
158 | + | ||
|
|
159 | + #stat summary | ||
|
|
160 | + range =65 | ||
|
|
161 | + @histogram = { data: Array.new(range,0), summary: {} } | ||
|
|
162 | + user = Hash.new(0) | ||
|
|
163 | + @submissions.find_each do |sub| | ||
|
|
164 | + d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 | ||
|
|
165 | + @histogram[:data][d.to_i] += 1 if d < range | ||
|
|
166 | + user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max | ||
|
|
167 | + end | ||
|
|
168 | + @histogram[:summary][:max] = [@histogram[:data].max,1].max | ||
|
|
169 | + | ||
|
|
170 | + @summary = { attempt: user.count, solve: 0 } | ||
|
|
171 | + user.each_value { |v| @summary[:solve] += 1 if v == 1 } | ||
|
158 | end |
|
172 | end |
|
159 |
|
173 | ||
|
160 | def manage |
|
174 | def manage |
@@ -257,4 +271,7 | |||||
|
257 | problems |
|
271 | problems |
|
258 | end |
|
272 | end |
|
259 |
|
273 | ||
|
|
274 | + def get_problems_stat | ||
|
|
275 | + end | ||
|
|
276 | + | ||
|
260 | end |
|
277 | end |
@@ -105,91 +105,87 | |||||
|
105 | end |
|
105 | end |
|
106 | end |
|
106 | end |
|
107 |
|
107 | ||
|
108 |
- |
|
108 | + return unless @problem |
|
109 | - #aggregrate by language |
|
109 | + |
|
110 | - @by_lang = {} |
|
110 | + @by_lang = {} #aggregrate by language |
|
111 | - Submission.where(problem_id: @problem.id).find_each do |sub| |
|
||
|
112 | - lang = Language.find_by_id(sub.language_id) |
|
||
|
113 | - next unless lang |
|
||
|
114 | - next unless sub.points >= @problem.full_score |
|
||
|
115 |
|
111 | ||
|
116 | - #initialize |
|
112 | + range =65 |
|
117 | - unless @by_lang.has_key?(lang.pretty_name) |
|
113 | + @histogram = { data: Array.new(range,0), summary: {} } |
|
118 | - @by_lang[lang.pretty_name] = { |
|
114 | + @summary = {count: 0, solve: 0, attempt: 0} |
|
119 | - runtime: { avail: false, value: 2**30-1 }, |
|
115 | + user = Hash.new(0) |
|
120 | - memory: { avail: false, value: 2**30-1 }, |
|
116 | + Submission.where(problem_id: @problem.id).find_each do |sub| |
|
121 | - length: { avail: false, value: 2**30-1 }, |
|
117 | + #histogram |
|
122 | - first: { avail: false, value: DateTime.new(3000,1,1) } |
|
118 | + d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
123 | - } |
|
119 | + @histogram[:data][d.to_i] += 1 if d < range |
|
124 | - end |
|
||
|
125 |
|
120 | ||
|
126 | - if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
121 | + @summary[:count] += 1 |
|
127 | - @by_lang[lang.pretty_name][:runtime] = { |
|
122 | + user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max |
|
128 | - avail: true, |
|
||
|
129 | - user_id: sub.user_id, |
|
||
|
130 | - value: sub.max_runtime, |
|
||
|
131 | - sub_id: sub.id |
|
||
|
132 | - } |
|
||
|
133 | - end |
|
||
|
134 |
|
123 | ||
|
135 | - if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
124 | + lang = Language.find_by_id(sub.language_id) |
|
136 | - @by_lang[lang.pretty_name][:memory] = { |
|
125 | + next unless lang |
|
137 | - avail: true, |
|
126 | + next unless sub.points >= @problem.full_score |
|
138 | - user_id: sub.user_id, |
|
||
|
139 | - value: sub.peak_memory, |
|
||
|
140 | - sub_id: sub.id |
|
||
|
141 | - } |
|
||
|
142 | - end |
|
||
|
143 |
|
127 | ||
|
144 | - if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
128 | + #initialize |
|
145 | - !sub.user.admin? |
|
129 | + unless @by_lang.has_key?(lang.pretty_name) |
|
146 |
- |
|
130 | + @by_lang[lang.pretty_name] = { |
|
147 | - avail: true, |
|
131 | + runtime: { avail: false, value: 2**30-1 }, |
|
148 | - user_id: sub.user_id, |
|
132 | + memory: { avail: false, value: 2**30-1 }, |
|
149 | - value: sub.submitted_at, |
|
133 | + length: { avail: false, value: 2**30-1 }, |
|
150 | - sub_id: sub.id |
|
134 | + first: { avail: false, value: DateTime.new(3000,1,1) } |
|
151 |
- |
|
135 | + } |
|
152 |
- |
|
136 | + end |
|
153 |
|
137 | ||
|
154 | - if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
138 | + if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
155 | - @by_lang[lang.pretty_name][:length] = { |
|
139 | + @by_lang[lang.pretty_name][:runtime] = { avail: true, user_id: sub.user_id, value: sub.max_runtime, sub_id: sub.id } |
|
156 | - avail: true, |
|
||
|
157 | - user_id: sub.user_id, |
|
||
|
158 | - value: sub.effective_code_length, |
|
||
|
159 | - sub_id: sub.id |
|
||
|
160 | - } |
|
||
|
161 | - end |
|
||
|
162 | - end |
|
||
|
163 | - |
|
||
|
164 | - #process user_id |
|
||
|
165 | - @by_lang.each do |lang,prop| |
|
||
|
166 | - prop.each do |k,v| |
|
||
|
167 | - v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
||
|
168 | - end |
|
||
|
169 | end |
|
140 | end |
|
170 |
|
141 | ||
|
171 | - #sum into best |
|
142 | + if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
172 | - if @by_lang and @by_lang.first |
|
143 | + @by_lang[lang.pretty_name][:memory] = { avail: true, user_id: sub.user_id, value: sub.peak_memory, sub_id: sub.id } |
|
173 | - @best = @by_lang.first[1].clone |
|
144 | + end |
|
174 | - @by_lang.each do |lang,prop| |
|
145 | + |
|
175 | - if @best[:runtime][:value] >= prop[:runtime][:value] |
|
146 | + if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
176 | - @best[:runtime] = prop[:runtime] |
|
147 | + !sub.user.admin? |
|
177 | - @best[:runtime][:lang] = lang |
|
148 | + @by_lang[lang.pretty_name][:first] = { avail: true, user_id: sub.user_id, value: sub.submitted_at, sub_id: sub.id } |
|
178 |
- |
|
149 | + end |
|
179 | - if @best[:memory][:value] >= prop[:memory][:value] |
|
150 | + |
|
180 | - @best[:memory] = prop[:memory] |
|
151 | + if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
181 | - @best[:memory][:lang] = lang |
|
152 | + @by_lang[lang.pretty_name][:length] = { avail: true, user_id: sub.user_id, value: sub.effective_code_length, sub_id: sub.id } |
|
182 |
- |
|
153 | + end |
|
183 | - if @best[:length][:value] >= prop[:length][:value] |
|
154 | + end |
|
184 | - @best[:length] = prop[:length] |
|
155 | + |
|
185 | - @best[:length][:lang] = lang |
|
156 | + #process user_id |
|
186 | - end |
|
157 | + @by_lang.each do |lang,prop| |
|
187 | - if @best[:first][:value] >= prop[:first][:value] |
|
158 | + prop.each do |k,v| |
|
188 | - @best[:first] = prop[:first] |
|
159 | + v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
189 | - @best[:first][:lang] = lang |
|
160 | + end |
|
190 |
- |
|
161 | + end |
|
|
162 | + | ||
|
|
163 | + #sum into best | ||
|
|
164 | + if @by_lang and @by_lang.first | ||
|
|
165 | + @best = @by_lang.first[1].clone | ||
|
|
166 | + @by_lang.each do |lang,prop| | ||
|
|
167 | + if @best[:runtime][:value] >= prop[:runtime][:value] | ||
|
|
168 | + @best[:runtime] = prop[:runtime] | ||
|
|
169 | + @best[:runtime][:lang] = lang | ||
|
|
170 | + end | ||
|
|
171 | + if @best[:memory][:value] >= prop[:memory][:value] | ||
|
|
172 | + @best[:memory] = prop[:memory] | ||
|
|
173 | + @best[:memory][:lang] = lang | ||
|
|
174 | + end | ||
|
|
175 | + if @best[:length][:value] >= prop[:length][:value] | ||
|
|
176 | + @best[:length] = prop[:length] | ||
|
|
177 | + @best[:length][:lang] = lang | ||
|
|
178 | + end | ||
|
|
179 | + if @best[:first][:value] >= prop[:first][:value] | ||
|
|
180 | + @best[:first] = prop[:first] | ||
|
|
181 | + @best[:first][:lang] = lang | ||
|
191 | end |
|
182 | end |
|
192 | end |
|
183 | end |
|
193 | end |
|
184 | end |
|
|
185 | + | ||
|
|
186 | + @histogram[:summary][:max] = [@histogram[:data].max,1].max | ||
|
|
187 | + @summary[:attempt] = user.count | ||
|
|
188 | + user.each_value { |v| @summary[:solve] += 1 if v == 1 } | ||
|
194 | end |
|
189 | end |
|
|
190 | + | ||
|
195 | end |
|
191 | end |
@@ -111,7 +111,25 | |||||
|
111 |
|
111 | ||
|
112 | def profile |
|
112 | def profile |
|
113 | @user = User.find(params[:id]) |
|
113 | @user = User.find(params[:id]) |
|
114 |
- @submission = Submission.where(user_id: params[:id]) |
|
114 | + @submission = Submission.includes(:problem).where(user_id: params[:id]) |
|
|
115 | + | ||
|
|
116 | + range = 120 | ||
|
|
117 | + @histogram = { data: Array.new(range,0), summary: {} } | ||
|
|
118 | + @summary = {count: 0, solve: 0, attempt: 0} | ||
|
|
119 | + problem = Hash.new(0) | ||
|
|
120 | + | ||
|
|
121 | + @submission.find_each do |sub| | ||
|
|
122 | + #histogram | ||
|
|
123 | + d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 | ||
|
|
124 | + @histogram[:data][d.to_i] += 1 if d < range | ||
|
|
125 | + | ||
|
|
126 | + @summary[:count] += 1 | ||
|
|
127 | + problem[sub.problem] = [problem[sub.problem], (sub.points >= sub.problem.full_score) ? 1 : 0].max | ||
|
|
128 | + end | ||
|
|
129 | + | ||
|
|
130 | + @histogram[:summary][:max] = [@histogram[:data].max,1].max | ||
|
|
131 | + @summary[:attempt] = problem.count | ||
|
|
132 | + problem.each_value { |v| @summary[:solve] += 1 if v == 1 } | ||
|
115 | end |
|
133 | end |
|
116 |
|
134 | ||
|
117 | protected |
|
135 | protected |
@@ -54,6 +54,13 | |||||
|
54 | def self.download_file_basedir |
|
54 | def self.download_file_basedir |
|
55 | return "#{Rails.root}/data/tasks" |
|
55 | return "#{Rails.root}/data/tasks" |
|
56 | end |
|
56 | end |
|
|
57 | + | ||
|
|
58 | + def get_submission_stat | ||
|
|
59 | + result = Hash.new | ||
|
|
60 | + #total number of submission | ||
|
|
61 | + result[:total_sub] = Submission.where(problem_id: self.id).count | ||
|
|
62 | + result[:attempted_user] = Submission.where(problem_id: self.id).group_by(:user_id) | ||
|
|
63 | + end | ||
|
57 |
|
64 | ||
|
58 | protected |
|
65 | protected |
|
59 |
|
66 |
@@ -21,12 +21,18 | |||||
|
21 | %tbody |
|
21 | %tbody |
|
22 | %tr{class: cycle('info-even','info-odd')} |
|
22 | %tr{class: cycle('info-even','info-odd')} |
|
23 | %td.field User: |
|
23 | %td.field User: |
|
24 | - %td.value= "(#{@submission.user.login}) #{@submission.user.full_name}" |
|
24 | + %td.value |
|
|
25 | + - if @submission.user | ||
|
|
26 | + = link_to "(#{@submission.user.login})", controller: "users", action: "profile", id: @submission.user | ||
|
|
27 | + = @submission.user.full_name | ||
|
|
28 | + - else | ||
|
|
29 | + = "(n/a)" | ||
|
25 | %tr{class: cycle('info-even','info-odd')} |
|
30 | %tr{class: cycle('info-even','info-odd')} |
|
26 | %td.field Problem: |
|
31 | %td.field Problem: |
|
27 | %td.value |
|
32 | %td.value |
|
28 | - if @submission.problem!=nil |
|
33 | - if @submission.problem!=nil |
|
29 |
- = "(#{@submission.problem.name}) |
|
34 | + = link_to "(#{@submission.problem.name})", controller: "problems", action: "stat", id: @submission.problem |
|
|
35 | + = @submission.problem.full_name | ||
|
30 | - else |
|
36 | - else |
|
31 | = "(n/a)" |
|
37 | = "(n/a)" |
|
32 | %tr{class: cycle('info-even','info-odd')} |
|
38 | %tr{class: cycle('info-even','info-odd')} |
@@ -6,6 +6,23 | |||||
|
6 | %h1 Problem stat: #{@problem.name} |
|
6 | %h1 Problem stat: #{@problem.name} |
|
7 | %h2 Overview |
|
7 | %h2 Overview |
|
8 |
|
8 | ||
|
|
9 | + | ||
|
|
10 | + %table.info | ||
|
|
11 | + %thead | ||
|
|
12 | + %tr.info-head | ||
|
|
13 | + %th Stat | ||
|
|
14 | + %th Value | ||
|
|
15 | + %tbody | ||
|
|
16 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
17 | + %td Submissions | ||
|
|
18 | + %td= @submissions.count | ||
|
|
19 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
20 | + %td Solved/Attempted User | ||
|
|
21 | + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) | ||
|
|
22 | + | ||
|
|
23 | + %h2 Submissions Count | ||
|
|
24 | + = render partial: 'application/bar_graph', locals: { histogram: @histogram } | ||
|
|
25 | + | ||
|
9 | %h2 Submissions |
|
26 | %h2 Submissions |
|
10 | - if @submissions and @submissions.count > 0 |
|
27 | - if @submissions and @submissions.count > 0 |
|
11 | %table.info#main_table |
|
28 | %table.info#main_table |
@@ -1,48 +1,99 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'local_jquery' | ||
|
|
3 | + | ||
|
|
4 | + :javascript | ||
|
|
5 | + $(document).ready( function() { | ||
|
|
6 | + $("#mem_remark").hover( function() { | ||
|
|
7 | + $("#mem_remark_box").show(); | ||
|
|
8 | + }, function() { | ||
|
|
9 | + $("#mem_remark_box").hide(); | ||
|
|
10 | + }); | ||
|
|
11 | + }); | ||
|
|
12 | + alert("hahaha"); | ||
|
1 | :css |
|
13 | :css |
|
2 | .hof_user { color: orangered; font-style: italic; } |
|
14 | .hof_user { color: orangered; font-style: italic; } |
|
3 | .hof_language { color: green; font-style: italic; } |
|
15 | .hof_language { color: green; font-style: italic; } |
|
4 | .hof_value { color: deeppink;font-style: italic; } |
|
16 | .hof_value { color: deeppink;font-style: italic; } |
|
|
17 | + .info_param { font-weight: bold;text-align: right; } | ||
|
|
18 | + .tooltip { | ||
|
|
19 | + font-family: Verdana,sans-serif; | ||
|
|
20 | + font-weight: normal; | ||
|
|
21 | + text-align: left; | ||
|
|
22 | + font-size: 1.0em; | ||
|
|
23 | + color: black; | ||
|
|
24 | + line-height: 1.1; | ||
|
|
25 | + display: none; | ||
|
|
26 | + min-width: 20em; | ||
|
|
27 | + position: absolute; | ||
|
|
28 | + left: 25px; | ||
|
|
29 | + bottom: 5px; | ||
|
|
30 | + border: 1px solid; | ||
|
|
31 | + padding: 5px; | ||
|
|
32 | + background-color: #FFF; | ||
|
|
33 | + word-wrap: break-word; | ||
|
|
34 | + z-index: 9999; | ||
|
|
35 | + overflow: auto; | ||
|
|
36 | + } | ||
|
5 |
|
37 | ||
|
6 |
- %h |
|
38 | + %h1 (#{Problem.find(params[:id]).name}) #{Problem.find(params[:id]).full_name} |
|
|
39 | + | ||
|
|
40 | + %h2 Problem Stat | ||
|
|
41 | + %table.info | ||
|
|
42 | + %thead | ||
|
|
43 | + %tr.info-head | ||
|
|
44 | + %th Stat | ||
|
|
45 | + %th Value | ||
|
|
46 | + %tbody | ||
|
|
47 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
48 | + %td.info_param Submissions | ||
|
|
49 | + %td= @summary[:count] | ||
|
|
50 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
51 | + %td.info_param Solved/Attempted User | ||
|
|
52 | + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) | ||
|
|
53 | + - if @best | ||
|
|
54 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
55 | + %td.info_param Best Runtime | ||
|
|
56 | + %td | ||
|
|
57 | + by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} | ||
|
|
58 | + using <span class="hof_language">#{@best[:runtime][:lang]}</span> | ||
|
|
59 | + with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span> | ||
|
|
60 | + at submission | ||
|
|
61 | + = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id]) | ||
|
|
62 | + | ||
|
|
63 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
64 | + %td.info_param | ||
|
|
65 | + Best Memory Usage | ||
|
|
66 | + %sup{ id: "mem_remark", style: "position:relative; color: blue;"} | ||
|
|
67 | + [?] | ||
|
|
68 | + %span.tooltip#mem_remark_box | ||
|
|
69 | + This counts only for submission with 100% score. | ||
|
|
70 | + Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...) | ||
|
|
71 | + %td | ||
|
|
72 | + by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} | ||
|
|
73 | + using <span class="hof_language">#{@best[:memory][:lang]}</span> | ||
|
|
74 | + with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span> | ||
|
|
75 | + at submission | ||
|
|
76 | + = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) | ||
|
|
77 | + | ||
|
|
78 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
79 | + %td.info_param Shortest Code | ||
|
|
80 | + %td | ||
|
|
81 | + by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]} | ||
|
|
82 | + using <span class="hof_language">#{@best[:length][:lang]}</span> | ||
|
|
83 | + with <span class="hof_value">#{@best[:length][:value]} bytes</span> | ||
|
|
84 | + at submission | ||
|
|
85 | + = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id]) | ||
|
|
86 | + | ||
|
|
87 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
88 | + %td.info_param First solver | ||
|
|
89 | + %td | ||
|
|
90 | + #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver | ||
|
|
91 | + using <span class="hof_language">#{@best[:first][:lang]}</span> | ||
|
|
92 | + on <span class="hof_value">#{@best[:first][:value]}</span> | ||
|
|
93 | + at submission | ||
|
|
94 | + = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id]) | ||
|
7 |
|
95 | ||
|
8 | - if @best |
|
96 | - if @best |
|
9 | - %b Best Runtime: |
|
||
|
10 | - by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} |
|
||
|
11 | - using <span class="hof_language">#{@best[:runtime][:lang]}</span> |
|
||
|
12 | - with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span> |
|
||
|
13 | - at submission |
|
||
|
14 | - = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id]) |
|
||
|
15 | - %br/ |
|
||
|
16 | - |
|
||
|
17 | - %b Best Memory Usage: |
|
||
|
18 | - by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} |
|
||
|
19 | - using <span class="hof_language">#{@best[:memory][:lang]}</span> |
|
||
|
20 | - with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span> |
|
||
|
21 | - at submission |
|
||
|
22 | - = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) |
|
||
|
23 | - %br/ |
|
||
|
24 | - |
|
||
|
25 | - %b Shortest Code: |
|
||
|
26 | - by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]} |
|
||
|
27 | - using <span class="hof_language">#{@best[:length][:lang]}</span> |
|
||
|
28 | - with <span class="hof_value">#{@best[:length][:value]} bytes</span> |
|
||
|
29 | - at submission |
|
||
|
30 | - = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id]) |
|
||
|
31 | - %br/ |
|
||
|
32 | - |
|
||
|
33 | - %b First solver: |
|
||
|
34 | - #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver |
|
||
|
35 | - using <span class="hof_language">#{@best[:first][:lang]}</span> |
|
||
|
36 | - on <span class="hof_value">#{@best[:first][:value]}</span> |
|
||
|
37 | - at submission |
|
||
|
38 | - = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id]) |
|
||
|
39 | - %br/ |
|
||
|
40 | - |
|
||
|
41 | - |
|
||
|
42 | - %p |
|
||
|
43 | - This counts only for submission with 100% score <br/> |
|
||
|
44 | - Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...) |
|
||
|
45 | - |
|
||
|
46 | %h2 By language |
|
97 | %h2 By language |
|
47 |
|
98 | ||
|
48 | %table.info |
|
99 | %table.info |
@@ -75,5 +126,3 | |||||
|
75 | = "(#{value[:first][:value]} @" |
|
126 | = "(#{value[:first][:value]} @" |
|
76 | = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe |
|
127 | = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe |
|
77 |
|
128 | ||
|
78 | - - else |
|
||
|
79 | - %h3 No submissions |
|
@@ -6,7 +6,7 | |||||
|
6 | / %h1 All-Time Hall of Fame |
|
6 | / %h1 All-Time Hall of Fame |
|
7 |
|
7 | ||
|
8 |
|
8 | ||
|
9 |
- %h1 |
|
9 | + %h1 Hall of Fame |
|
10 | .task-menu |
|
10 | .task-menu |
|
11 | Tasks |
|
11 | Tasks |
|
12 | %br/ |
|
12 | %br/ |
@@ -18,5 +18,6 | |||||
|
18 | Please select a problem. |
|
18 | Please select a problem. |
|
19 | - else |
|
19 | - else |
|
20 | =render partial: 'task_hof' |
|
20 | =render partial: 'task_hof' |
|
|
21 | + %h2 Submission History | ||
|
|
22 | + =render partial: 'application/bar_graph', locals: { histogram: @histogram } | ||
|
21 |
|
23 | ||
|
22 | - |
|
@@ -1,9 +1,9 | |||||
|
1 | - content_for :header do |
|
1 | - content_for :header do |
|
2 | = javascript_include_tag 'local_jquery' |
|
2 | = javascript_include_tag 'local_jquery' |
|
3 |
|
3 | ||
|
4 | - %script{:type=>"text/javascript"} |
|
4 | + :javascript |
|
5 | $(function () { |
|
5 | $(function () { |
|
6 | - $('#submission_table').tablesorter({widgets: ['zebra']}); |
|
6 | + $('#submission_table').tablesorter({widgets: ['zebra']}); |
|
7 | }); |
|
7 | }); |
|
8 |
|
8 | ||
|
9 | :css |
|
9 | :css |
@@ -11,16 +11,30 | |||||
|
11 | font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier; |
|
11 | font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier; |
|
12 | } |
|
12 | } |
|
13 |
|
13 | ||
|
14 |
- %h1= @user.full_name |
|
14 | + %h1= @user.full_name |
|
15 |
|
15 | ||
|
16 | - %h2 Basic info |
|
||
|
17 | <b>Login:</b> #{@user.login} <br/> |
|
16 | <b>Login:</b> #{@user.login} <br/> |
|
18 | <b>Full name:</b> #{@user.full_name} <br /> |
|
17 | <b>Full name:</b> #{@user.full_name} <br /> |
|
19 |
|
18 | ||
|
20 |
|
19 | ||
|
21 | %h2 Problem Stat |
|
20 | %h2 Problem Stat |
|
|
21 | + %table.info | ||
|
|
22 | + %thead | ||
|
|
23 | + %tr.info-head | ||
|
|
24 | + %th Stat | ||
|
|
25 | + %th Value | ||
|
|
26 | + %tbody | ||
|
|
27 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
28 | + %td.info_param Submissions | ||
|
|
29 | + %td= @summary[:count] | ||
|
|
30 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
31 | + %td.info_param Solved/Attempted Problem | ||
|
|
32 | + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) | ||
|
22 |
|
33 | ||
|
23 | - %h2 Submissions |
|
34 | + %h2 Submission History |
|
|
35 | + | ||
|
|
36 | + =render partial: 'application/bar_graph', locals: {histogram: @histogram, param: {bar_width: 7}} | ||
|
|
37 | + | ||
|
24 |
|
38 | ||
|
25 | %table.tablesorter-cafe#submission_table |
|
39 | %table.tablesorter-cafe#submission_table |
|
26 | %thead |
|
40 | %thead |
@@ -39,7 +53,7 | |||||
|
39 | - next unless s.problem |
|
53 | - next unless s.problem |
|
40 | %tr |
|
54 | %tr |
|
41 | %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id |
|
55 | %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id |
|
42 | - %td= s.problem.name |
|
56 | + %td= link_to s.problem.name, controller: "problems", action: "stat", id: s.problem |
|
43 | %td= s.problem.full_name |
|
57 | %td= s.problem.full_name |
|
44 | %td= s.language.pretty_name |
|
58 | %td= s.language.pretty_name |
|
45 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
@@ -29,8 +29,8 | |||||
|
29 | end |
|
29 | end |
|
30 |
|
30 | ||
|
31 | def self.start_grader(env) |
|
31 | def self.start_grader(env) |
|
32 | - GraderScript.call_grader "#{env} queue &" |
|
32 | + GraderScript.call_grader "#{env} queue --err-log &" |
|
33 | - GraderScript.call_grader "#{env} test_request &" |
|
33 | + GraderScript.call_grader "#{env} test_request -err-log &" |
|
34 | end |
|
34 | end |
|
35 |
|
35 | ||
|
36 | def self.call_import_problem(problem_name, |
|
36 | def self.call_import_problem(problem_name, |
You need to be logged in to leave comments.
Login now