Description:
added time out check for code jom submissions
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r242:803c8843ad9b - - 3 files changed: 29 inserted, 15 deleted
@@ -171,46 +171,55 | |||||
|
171 | else |
|
171 | else |
|
172 | prepare_announcements |
|
172 | prepare_announcements |
|
173 | end |
|
173 | end |
|
174 | render(:partial => 'announcement', |
|
174 | render(:partial => 'announcement', |
|
175 | :collection => @announcements, |
|
175 | :collection => @announcements, |
|
176 | :locals => {:announcement_effect => true}) |
|
176 | :locals => {:announcement_effect => true}) |
|
177 | end |
|
177 | end |
|
178 |
|
178 | ||
|
179 | # |
|
179 | # |
|
180 | # actions for Code Jom |
|
180 | # actions for Code Jom |
|
181 | # |
|
181 | # |
|
182 | def download_input |
|
182 | def download_input |
|
|
183 | + user = User.find(session[:user_id]) | ||
|
|
184 | + | ||
|
|
185 | + if Configuration.time_limit_mode? and user.contest_finished? | ||
|
|
186 | + redirect_to :action => 'list' and return | ||
|
|
187 | + end | ||
|
|
188 | + | ||
|
183 | problem = Problem.find(params[:id]) |
|
189 | problem = Problem.find(params[:id]) |
|
184 | - user = User.find(session[:user_id]) |
|
||
|
185 | if user.can_request_new_test_pair_for? problem |
|
190 | if user.can_request_new_test_pair_for? problem |
|
186 | assignment = user.get_new_test_pair_assignment_for problem |
|
191 | assignment = user.get_new_test_pair_assignment_for problem |
|
187 | assignment.save |
|
192 | assignment.save |
|
188 |
|
193 | ||
|
189 | send_data(assignment.test_pair.input, |
|
194 | send_data(assignment.test_pair.input, |
|
190 | { :filename => "#{problem.name}-#{assignment.request_number}.in", |
|
195 | { :filename => "#{problem.name}-#{assignment.request_number}.in", |
|
191 | :type => 'text/plain' }) |
|
196 | :type => 'text/plain' }) |
|
192 | else |
|
197 | else |
|
193 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
198 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
194 | send_data(recent_assignment.test_pair.input, |
|
199 | send_data(recent_assignment.test_pair.input, |
|
195 | { :filename => "#{problem.name}-#{recent_assignment.request_number}.in", |
|
200 | { :filename => "#{problem.name}-#{recent_assignment.request_number}.in", |
|
196 | :type => 'text/plain' }) |
|
201 | :type => 'text/plain' }) |
|
197 | end |
|
202 | end |
|
198 | end |
|
203 | end |
|
199 |
|
204 | ||
|
200 | def submit_solution |
|
205 | def submit_solution |
|
201 | problem = Problem.find(params[:id]) |
|
206 | problem = Problem.find(params[:id]) |
|
202 | user = User.find(session[:user_id]) |
|
207 | user = User.find(session[:user_id]) |
|
203 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
208 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
204 |
|
209 | ||
|
|
210 | + if Configuration.time_limit_mode? and user.contest_finished? | ||
|
|
211 | + redirect_to :action => 'list' and return | ||
|
|
212 | + end | ||
|
|
213 | + | ||
|
205 | if recent_assignment == nil |
|
214 | if recent_assignment == nil |
|
206 | flash[:notice] = 'You have not requested for any input data for this problem. Please download an input first.' |
|
215 | flash[:notice] = 'You have not requested for any input data for this problem. Please download an input first.' |
|
207 | session[:current_problem_id] = problem.id |
|
216 | session[:current_problem_id] = problem.id |
|
208 | redirect_to :action => 'list' and return |
|
217 | redirect_to :action => 'list' and return |
|
209 | end |
|
218 | end |
|
210 |
|
219 | ||
|
211 | if recent_assignment.expired? |
|
220 | if recent_assignment.expired? |
|
212 | flash[:notice] = 'The current input is expired. Please download a new input data.' |
|
221 | flash[:notice] = 'The current input is expired. Please download a new input data.' |
|
213 | session[:current_problem_id] = problem.id |
|
222 | session[:current_problem_id] = problem.id |
|
214 | redirect_to :action => 'list' and return |
|
223 | redirect_to :action => 'list' and return |
|
215 | end |
|
224 | end |
|
216 |
|
225 |
@@ -1,21 +1,26 | |||||
|
1 | .problem-panel{:id => "problem-panel-#{problem.id}", :style => "#{(problem.id != @current_problem_id) ? "display:none" : ""}"} |
|
1 | .problem-panel{:id => "problem-panel-#{problem.id}", :style => "#{(problem.id != @current_problem_id) ? "display:none" : ""}"} |
|
2 | - .problem-form{:id => "problem-form-#{problem.id}"} |
|
2 | + - if (not Configuration.time_limit_mode?) or (not @user.contest_finished?) |
|
3 | - - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do |
|
3 | + .problem-form{:id => "problem-form-#{problem.id}"} |
|
4 | - %b Input: |
|
4 | + - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do |
|
5 | - %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"} |
|
5 | + %b Input: |
|
6 | - %span{:id => "problem-timing-message-#{problem.id}"} |
|
6 | + %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"} |
|
7 | - = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit." |
|
7 | + %span{:id => "problem-timing-message-#{problem.id}"} |
|
8 | - %div{:id => "problem-submission-form-#{problem.id}"} |
|
8 | + = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit." |
|
9 | - - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do |
|
9 | + %div{:id => "problem-submission-form-#{problem.id}"} |
|
10 | - %b Submit output: |
|
10 | + - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do |
|
11 | - %input{:type => "file", :name => "file"} |
|
11 | + %b Submit output: |
|
12 |
- %input{:type => " |
|
12 | + %input{:type => "file", :name => "file"} |
|
|
13 | + %input{:type => "submit", :value => "Submit solution"} | ||
|
|
14 | + - else | ||
|
|
15 | + .problem-form | ||
|
|
16 | + %p | ||
|
|
17 | + The contest is over, you can view the tasks, but you can no longer submit. | ||
|
13 |
|
18 | ||
|
14 | .problem-description |
|
19 | .problem-description |
|
15 | - if problem.description!=nil |
|
20 | - if problem.description!=nil |
|
16 | - if problem.description.markdowned |
|
21 | - if problem.description.markdowned |
|
17 | ~ markdown(problem.description.body) |
|
22 | ~ markdown(problem.description.body) |
|
18 | - else |
|
23 | - else |
|
19 | = problem.description.body |
|
24 | = problem.description.body |
|
20 | - else |
|
25 | - else |
|
21 | (not available) |
|
26 | (not available) |
@@ -1,24 +1,24 | |||||
|
1 | # This file is auto-generated from the current state of the database. Instead of editing this file, |
|
1 | # This file is auto-generated from the current state of the database. Instead of editing this file, |
|
2 | # please use the migrations feature of Active Record to incrementally modify your database, and |
|
2 | # please use the migrations feature of Active Record to incrementally modify your database, and |
|
3 | # then regenerate this schema definition. |
|
3 | # then regenerate this schema definition. |
|
4 | # |
|
4 | # |
|
5 | # Note that this schema.rb definition is the authoritative source for your database schema. If you need |
|
5 | # Note that this schema.rb definition is the authoritative source for your database schema. If you need |
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | # |
|
9 | # |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
11 |
|
11 | ||
|
12 |
- ActiveRecord::Schema.define(:version => 2010012 |
|
12 | + ActiveRecord::Schema.define(:version => 20100129041917) do |
|
13 |
|
13 | ||
|
14 | create_table "announcements", :force => true do |t| |
|
14 | create_table "announcements", :force => true do |t| |
|
15 | t.string "author" |
|
15 | t.string "author" |
|
16 | t.text "body" |
|
16 | t.text "body" |
|
17 | t.boolean "published" |
|
17 | t.boolean "published" |
|
18 | t.datetime "created_at" |
|
18 | t.datetime "created_at" |
|
19 | t.datetime "updated_at" |
|
19 | t.datetime "updated_at" |
|
20 | t.boolean "frontpage", :default => false |
|
20 | t.boolean "frontpage", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
22 | t.string "title" |
|
22 | t.string "title" |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
@@ -177,26 +177,26 | |||||
|
177 | t.integer "user_id" |
|
177 | t.integer "user_id" |
|
178 | t.integer "problem_id" |
|
178 | t.integer "problem_id" |
|
179 | t.integer "test_pair_id" |
|
179 | t.integer "test_pair_id" |
|
180 | t.integer "test_pair_number" |
|
180 | t.integer "test_pair_number" |
|
181 | t.integer "request_number" |
|
181 | t.integer "request_number" |
|
182 | t.datetime "created_at" |
|
182 | t.datetime "created_at" |
|
183 | t.datetime "updated_at" |
|
183 | t.datetime "updated_at" |
|
184 | t.boolean "submitted" |
|
184 | t.boolean "submitted" |
|
185 | end |
|
185 | end |
|
186 |
|
186 | ||
|
187 | create_table "test_pairs", :force => true do |t| |
|
187 | create_table "test_pairs", :force => true do |t| |
|
188 | t.integer "problem_id" |
|
188 | t.integer "problem_id" |
|
189 | - t.text "input" |
|
189 | + t.text "input", :limit => 16777215 |
|
190 | - t.text "solution" |
|
190 | + t.text "solution", :limit => 16777215 |
|
191 | t.datetime "created_at" |
|
191 | t.datetime "created_at" |
|
192 | t.datetime "updated_at" |
|
192 | t.datetime "updated_at" |
|
193 | t.integer "number" |
|
193 | t.integer "number" |
|
194 | end |
|
194 | end |
|
195 |
|
195 | ||
|
196 | create_table "test_requests", :force => true do |t| |
|
196 | create_table "test_requests", :force => true do |t| |
|
197 | t.integer "user_id" |
|
197 | t.integer "user_id" |
|
198 | t.integer "problem_id" |
|
198 | t.integer "problem_id" |
|
199 | t.integer "submission_id" |
|
199 | t.integer "submission_id" |
|
200 | t.string "input_file_name" |
|
200 | t.string "input_file_name" |
|
201 | t.string "output_file_name" |
|
201 | t.string "output_file_name" |
|
202 | t.string "running_stat" |
|
202 | t.string "running_stat" |
You need to be logged in to leave comments.
Login now