Description:
merge algo feature
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r509:bb124a034509 - - 8 files changed: 112 inserted, 53 deleted
@@ -0,0 +1,5 | |||||
|
|
1 | + class AddIpToSubmissions < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + add_column :submissions, :ip_address, :string | ||
|
|
4 | + end | ||
|
|
5 | + end |
@@ -67,6 +67,7 | |||||
|
67 | @submission.source_filename = params['file'].original_filename |
|
67 | @submission.source_filename = params['file'].original_filename |
|
68 | end |
|
68 | end |
|
69 | @submission.submitted_at = Time.new.gmtime |
|
69 | @submission.submitted_at = Time.new.gmtime |
|
|
70 | + @submission.ip_address = request.remote_ip | ||
|
70 |
|
71 | ||
|
71 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
72 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
72 | @submission.errors.add_to_base "The contest is over." |
|
73 | @submission.errors.add_to_base "The contest is over." |
@@ -16,12 +16,14 | |||||
|
16 |
|
16 | ||
|
17 | date_and_time = '%Y-%m-%d %H:%M' |
|
17 | date_and_time = '%Y-%m-%d %H:%M' |
|
18 | begin |
|
18 | begin |
|
19 | - @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
19 | + md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
|
20 | + @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) | ||
|
20 | rescue |
|
21 | rescue |
|
21 | @since_time = DateTime.new(1000,1,1) |
|
22 | @since_time = DateTime.new(1000,1,1) |
|
22 | end |
|
23 | end |
|
23 | begin |
|
24 | begin |
|
24 | - @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
25 | + md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
|
26 | + @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) | ||
|
25 | rescue |
|
27 | rescue |
|
26 | @until_time = DateTime.new(3000,1,1) |
|
28 | @until_time = DateTime.new(3000,1,1) |
|
27 | end |
|
29 | end |
@@ -38,7 +40,11 | |||||
|
38 | .minimum(:created_at), |
|
40 | .minimum(:created_at), |
|
39 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
41 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
40 | user.id,@since_time,@until_time) |
|
42 | user.id,@since_time,@until_time) |
|
41 | - .maximum(:created_at) |
|
43 | + .maximum(:created_at), |
|
|
44 | + ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", | ||
|
|
45 | + user.id,@since_time,@until_time) | ||
|
|
46 | + .select(:ip_address).uniq | ||
|
|
47 | + | ||
|
42 | } |
|
48 | } |
|
43 | end |
|
49 | end |
|
44 | end |
|
50 | end |
@@ -164,7 +170,7 | |||||
|
164 |
|
170 | ||
|
165 | #sum into best |
|
171 | #sum into best |
|
166 | if @by_lang and @by_lang.first |
|
172 | if @by_lang and @by_lang.first |
|
167 | - @best = @by_lang.first[1] |
|
173 | + @best = @by_lang.first[1].clone |
|
168 | @by_lang.each do |lang,prop| |
|
174 | @by_lang.each do |lang,prop| |
|
169 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
175 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
170 | @best[:runtime] = prop[:runtime] |
|
176 | @best[:runtime] = prop[:runtime] |
@@ -1,27 +1,61 | |||||
|
1 | %style{type: "text/css"} |
|
1 | %style{type: "text/css"} |
|
2 | = @css_style |
|
2 | = @css_style |
|
|
3 | + :css | ||
|
|
4 | + .field { | ||
|
|
5 | + font-weight: bold; | ||
|
|
6 | + text-align: right; | ||
|
|
7 | + padding: 3px; | ||
|
|
8 | + } | ||
|
|
9 | + | ||
|
3 |
|
10 | ||
|
4 | %h1= "Submission: #{@submission.id}" |
|
11 | %h1= "Submission: #{@submission.id}" |
|
5 |
|
12 | ||
|
6 | - %p |
|
13 | + |
|
7 | - User: |
|
14 | + %h2 Stat |
|
8 | - = "(#{@submission.user.login}) #{@submission.user.full_name}" |
|
||
|
9 | - %br/ |
|
||
|
10 | - Problem: |
|
||
|
11 | - - if @submission.problem!=nil |
|
||
|
12 | - = "#{@submission.problem.full_name}" |
|
||
|
13 | - - else |
|
||
|
14 | - = "(n/a)" |
|
||
|
15 | - %br/ |
|
||
|
16 | - = "Number: #{@submission.number}" |
|
||
|
17 | - %br/ |
|
||
|
18 | - = "Submitted at: #{format_short_time(@submission.submitted_at)}" |
|
||
|
19 | - %br/ |
|
||
|
20 | - = "Points : #{@submission.points}/#{@submission.problem.full_score}" |
|
||
|
21 | - %br/ |
|
||
|
22 | - = "Comment : #{@submission.grader_comment}" |
|
||
|
23 |
|
15 | ||
|
24 | - %b Source code (first 10kb) |
|
16 | + %table.info |
|
|
17 | + %thead | ||
|
|
18 | + %tr.info-head | ||
|
|
19 | + %th Field | ||
|
|
20 | + %th Value | ||
|
|
21 | + %tbody | ||
|
|
22 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
23 | + %td.field User: | ||
|
|
24 | + %td.value= "(#{@submission.user.login}) #{@submission.user.full_name}" | ||
|
|
25 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
26 | + %td.field Problem: | ||
|
|
27 | + %td.value | ||
|
|
28 | + - if @submission.problem!=nil | ||
|
|
29 | + = "(#{@submission.problem.name}) #{@submission.problem.full_name}" | ||
|
|
30 | + - else | ||
|
|
31 | + = "(n/a)" | ||
|
|
32 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
33 | + %td.field Tries: | ||
|
|
34 | + %td.value= @submission.number | ||
|
|
35 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
36 | + %td.field Submitted: | ||
|
|
37 | + %td.value #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)}) | ||
|
|
38 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
39 | + %td.field Graded: | ||
|
|
40 | + %td.value #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)}) | ||
|
|
41 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
42 | + %td.field Points: | ||
|
|
43 | + %td.value #{@submission.points}/#{@submission.problem.full_score} | ||
|
|
44 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
45 | + %td.field Comment: | ||
|
|
46 | + %td.value #{@submission.grader_comment} | ||
|
|
47 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
48 | + %td.field Runtime (s): | ||
|
|
49 | + %td.value #{@submission.max_runtime} | ||
|
|
50 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
51 | + %td.field Memory (kb): | ||
|
|
52 | + %td.value #{@submission.peak_memory} | ||
|
|
53 | + - if session[:admin] | ||
|
|
54 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
55 | + %td.field IP: | ||
|
|
56 | + %td.value #{@submission.ip_address} | ||
|
|
57 | + | ||
|
|
58 | + %h2 Source code | ||
|
25 | //%div.highlight{:style => "border: 1px solid black;"} |
|
59 | //%div.highlight{:style => "border: 1px solid black;"} |
|
26 | =@formatted_code.html_safe |
|
60 | =@formatted_code.html_safe |
|
27 |
|
61 |
@@ -3,7 +3,7 | |||||
|
3 | .hof_language { color: green; font-style: italic; } |
|
3 | .hof_language { color: green; font-style: italic; } |
|
4 | .hof_value { color: deeppink;font-style: italic; } |
|
4 | .hof_value { color: deeppink;font-style: italic; } |
|
5 |
|
5 | ||
|
6 | - %h2 Overall |
|
6 | + %h2 Overall of #{Problem.find(params[:id]).full_name} |
|
7 |
|
7 | ||
|
8 | - if @best |
|
8 | - if @best |
|
9 | %b Best Runtime: |
|
9 | %b Best Runtime: |
@@ -17,7 +17,7 | |||||
|
17 | %b Best Memory Usage: |
|
17 | %b Best Memory Usage: |
|
18 | by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} |
|
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> |
|
19 | using <span class="hof_language">#{@best[:memory][:lang]}</span> |
|
20 | - with <span class="hof_value">#{@best[:memory][:value]} kbytes </span> |
|
20 | + with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span> |
|
21 | at submission |
|
21 | at submission |
|
22 | = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) |
|
22 | = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) |
|
23 | %br/ |
|
23 | %br/ |
@@ -63,7 +63,7 | |||||
|
63 | = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe |
|
63 | = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe |
|
64 | %td |
|
64 | %td |
|
65 | = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id] |
|
65 | = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id] |
|
66 | - = "(#{value[:memory][:value]} @" |
|
66 | + = "(#{number_with_delimiter(value[:memory][:value])} @" |
|
67 | = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe |
|
67 | = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe |
|
68 | %td |
|
68 | %td |
|
69 | = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id] |
|
69 | = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id] |
@@ -22,6 +22,7 | |||||
|
22 | %th login count |
|
22 | %th login count |
|
23 | %th earliest |
|
23 | %th earliest |
|
24 | %th latest |
|
24 | %th latest |
|
|
25 | + %th IP | ||
|
25 | %tbody |
|
26 | %tbody |
|
26 | - @logins.each do |l| |
|
27 | - @logins.each do |l| |
|
27 | %tr{class: cycle('info-even','info-odd')} |
|
28 | %tr{class: cycle('info-even','info-odd')} |
@@ -29,4 +30,7 | |||||
|
29 | %td= l[:full_name] |
|
30 | %td= l[:full_name] |
|
30 | %td= l[:count] |
|
31 | %td= l[:count] |
|
31 | %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' |
|
32 | %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' |
|
32 |
- %td= l[:max] ? time_ago_in_words(l[:max].in_time_zone) |
|
33 | + %td= l[:max] ? "#{l[:max].in_time_zone.strftime('%Y-%m-%d %H:%M.%S')} (#{time_ago_in_words(l[:max].in_time_zone)} ago)" : '' |
|
|
34 | + %td | ||
|
|
35 | + - l[:ip].each do |ip| | ||
|
|
36 | + #{ip.ip_address} <br/> |
@@ -31,6 +31,8 | |||||
|
31 | %th Language |
|
31 | %th Language |
|
32 | %th Result |
|
32 | %th Result |
|
33 | %th Score |
|
33 | %th Score |
|
|
34 | + - if session[:admin] | ||
|
|
35 | + %th IP | ||
|
34 | %tbody |
|
36 | %tbody |
|
35 | - @submission.each do |s| |
|
37 | - @submission.each do |s| |
|
36 | - next unless s.problem |
|
38 | - next unless s.problem |
@@ -40,7 +42,9 | |||||
|
40 | %td= s.problem.full_name |
|
42 | %td= s.problem.full_name |
|
41 | %td= s.language.pretty_name |
|
43 | %td= s.language.pretty_name |
|
42 | %td.fix-width= s.grader_comment |
|
44 | %td.fix-width= s.grader_comment |
|
43 |
- %td= s.points/s.problem.full_score |
|
45 | + %td= (s.points*100)/s.problem.full_score |
|
|
46 | + - if session[:admin] | ||
|
|
47 | + %td= s.ip_address | ||
|
44 |
|
48 | ||
|
45 |
|
49 | ||
|
46 |
|
50 |
@@ -11,16 +11,16 | |||||
|
11 | # |
|
11 | # |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
13 |
|
13 | ||
|
14 |
- ActiveRecord::Schema.define(:version => 20140 |
|
14 | + ActiveRecord::Schema.define(:version => 20140917150629) do |
|
15 |
|
15 | ||
|
16 | create_table "announcements", :force => true do |t| |
|
16 | create_table "announcements", :force => true do |t| |
|
17 | t.string "author" |
|
17 | t.string "author" |
|
18 |
- t.text "body" |
|
18 | + t.text "body" |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 |
- t.datetime "created_at", |
|
20 | + t.datetime "created_at", :null => false |
|
21 |
- t.datetime "updated_at", |
|
21 | + t.datetime "updated_at", :null => false |
|
22 |
- t.boolean "frontpage", |
|
22 | + t.boolean "frontpage", :default => false |
|
23 |
- t.boolean "contest_only", |
|
23 | + t.boolean "contest_only", :default => false |
|
24 | t.string "title" |
|
24 | t.string "title" |
|
25 | t.string "notes" |
|
25 | t.string "notes" |
|
26 | end |
|
26 | end |
@@ -50,19 +50,19 | |||||
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 | create_table "descriptions", :force => true do |t| |
|
52 | create_table "descriptions", :force => true do |t| |
|
53 |
- t.text "body" |
|
53 | + t.text "body" |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 |
- t.datetime "created_at", |
|
55 | + t.datetime "created_at", :null => false |
|
56 |
- t.datetime "updated_at", |
|
56 | + t.datetime "updated_at", :null => false |
|
57 | end |
|
57 | end |
|
58 |
|
58 | ||
|
59 | create_table "grader_configurations", :force => true do |t| |
|
59 | create_table "grader_configurations", :force => true do |t| |
|
60 | t.string "key" |
|
60 | t.string "key" |
|
61 | t.string "value_type" |
|
61 | t.string "value_type" |
|
62 | t.string "value" |
|
62 | t.string "value" |
|
63 |
- t.datetime "created_at", |
|
63 | + t.datetime "created_at", :null => false |
|
64 |
- t.datetime "updated_at", |
|
64 | + t.datetime "updated_at", :null => false |
|
65 |
- t.text "description" |
|
65 | + t.text "description" |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 | create_table "grader_processes", :force => true do |t| |
|
68 | create_table "grader_processes", :force => true do |t| |
@@ -97,10 +97,10 | |||||
|
97 | t.integer "sender_id" |
|
97 | t.integer "sender_id" |
|
98 | t.integer "receiver_id" |
|
98 | t.integer "receiver_id" |
|
99 | t.integer "replying_message_id" |
|
99 | t.integer "replying_message_id" |
|
100 | - t.text "body", :limit => 16777215 |
|
100 | + t.text "body" |
|
101 | t.boolean "replied" |
|
101 | t.boolean "replied" |
|
102 |
- t.datetime "created_at", |
|
102 | + t.datetime "created_at", :null => false |
|
103 |
- t.datetime "updated_at", |
|
103 | + t.datetime "updated_at", :null => false |
|
104 | end |
|
104 | end |
|
105 |
|
105 | ||
|
106 | create_table "problems", :force => true do |t| |
|
106 | create_table "problems", :force => true do |t| |
@@ -142,7 +142,7 | |||||
|
142 |
|
142 | ||
|
143 | create_table "sessions", :force => true do |t| |
|
143 | create_table "sessions", :force => true do |t| |
|
144 | t.string "session_id" |
|
144 | t.string "session_id" |
|
145 |
- t.text "data" |
|
145 | + t.text "data" |
|
146 | t.datetime "updated_at" |
|
146 | t.datetime "updated_at" |
|
147 | end |
|
147 | end |
|
148 |
|
148 | ||
@@ -163,16 +163,20 | |||||
|
163 | t.integer "user_id" |
|
163 | t.integer "user_id" |
|
164 | t.integer "problem_id" |
|
164 | t.integer "problem_id" |
|
165 | t.integer "language_id" |
|
165 | t.integer "language_id" |
|
166 |
- t.text "source" |
|
166 | + t.text "source" |
|
167 | t.binary "binary" |
|
167 | t.binary "binary" |
|
168 | t.datetime "submitted_at" |
|
168 | t.datetime "submitted_at" |
|
169 | t.datetime "compiled_at" |
|
169 | t.datetime "compiled_at" |
|
170 |
- t.text "compiler_message" |
|
170 | + t.text "compiler_message" |
|
171 | t.datetime "graded_at" |
|
171 | t.datetime "graded_at" |
|
172 | t.integer "points" |
|
172 | t.integer "points" |
|
173 |
- t.text "grader_comment" |
|
173 | + t.text "grader_comment" |
|
174 | t.integer "number" |
|
174 | t.integer "number" |
|
175 | t.string "source_filename" |
|
175 | t.string "source_filename" |
|
|
176 | + t.float "max_runtime" | ||
|
|
177 | + t.integer "peak_memory" | ||
|
|
178 | + t.integer "effective_code_length" | ||
|
|
179 | + t.string "ip_address" | ||
|
176 | end |
|
180 | end |
|
177 |
|
181 | ||
|
178 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
182 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
@@ -187,10 +191,10 | |||||
|
187 |
|
191 | ||
|
188 | create_table "test_pairs", :force => true do |t| |
|
192 | create_table "test_pairs", :force => true do |t| |
|
189 | t.integer "problem_id" |
|
193 | t.integer "problem_id" |
|
190 |
- t.text "input", :limit => |
|
194 | + t.text "input", :limit => 16777215 |
|
191 |
- t.text "solution", :limit => |
|
195 | + t.text "solution", :limit => 16777215 |
|
192 |
- t.datetime "created_at", |
|
196 | + t.datetime "created_at", :null => false |
|
193 |
- t.datetime "updated_at", |
|
197 | + t.datetime "updated_at", :null => false |
|
194 | end |
|
198 | end |
|
195 |
|
199 | ||
|
196 | create_table "test_requests", :force => true do |t| |
|
200 | create_table "test_requests", :force => true do |t| |
@@ -201,13 +205,13 | |||||
|
201 | t.string "output_file_name" |
|
205 | t.string "output_file_name" |
|
202 | t.string "running_stat" |
|
206 | t.string "running_stat" |
|
203 | t.integer "status" |
|
207 | t.integer "status" |
|
204 |
- t.datetime "updated_at", |
|
208 | + t.datetime "updated_at", :null => false |
|
205 | t.datetime "submitted_at" |
|
209 | t.datetime "submitted_at" |
|
206 | t.datetime "compiled_at" |
|
210 | t.datetime "compiled_at" |
|
207 |
- t.text "compiler_message" |
|
211 | + t.text "compiler_message" |
|
208 | t.datetime "graded_at" |
|
212 | t.datetime "graded_at" |
|
209 | t.string "grader_comment" |
|
213 | t.string "grader_comment" |
|
210 |
- t.datetime "created_at", |
|
214 | + t.datetime "created_at", :null => false |
|
211 | t.float "running_time" |
|
215 | t.float "running_time" |
|
212 | t.string "exit_status" |
|
216 | t.string "exit_status" |
|
213 | t.integer "memory_usage" |
|
217 | t.integer "memory_usage" |
@@ -235,6 +239,7 | |||||
|
235 | t.boolean "activated", :default => false |
|
239 | t.boolean "activated", :default => false |
|
236 | t.datetime "created_at" |
|
240 | t.datetime "created_at" |
|
237 | t.datetime "updated_at" |
|
241 | t.datetime "updated_at" |
|
|
242 | + t.string "section" | ||
|
238 | end |
|
243 | end |
|
239 |
|
244 | ||
|
240 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
245 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
You need to be logged in to leave comments.
Login now