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
@@ -180,8 +180,13 | |||
|
180 | 180 | # actions for Code Jom |
|
181 | 181 | # |
|
182 | 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 | 189 | problem = Problem.find(params[:id]) |
|
184 | - user = User.find(session[:user_id]) | |
|
185 | 190 | if user.can_request_new_test_pair_for? problem |
|
186 | 191 | assignment = user.get_new_test_pair_assignment_for problem |
|
187 | 192 | assignment.save |
@@ -202,6 +207,10 | |||
|
202 | 207 | user = User.find(session[:user_id]) |
|
203 | 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 | 214 | if recent_assignment == nil |
|
206 | 215 | flash[:notice] = 'You have not requested for any input data for this problem. Please download an input first.' |
|
207 | 216 | session[:current_problem_id] = problem.id |
@@ -1,15 +1,20 | |||
|
1 | 1 | .problem-panel{:id => "problem-panel-#{problem.id}", :style => "#{(problem.id != @current_problem_id) ? "display:none" : ""}"} |
|
2 | - .problem-form{:id => "problem-form-#{problem.id}"} | |
|
3 | - - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do | |
|
4 | - %b Input: | |
|
5 | - %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"} | |
|
6 | - %span{:id => "problem-timing-message-#{problem.id}"} | |
|
7 | - = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit." | |
|
8 | - %div{:id => "problem-submission-form-#{problem.id}"} | |
|
9 | - - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do | |
|
10 | - %b Submit output: | |
|
11 | - %input{:type => "file", :name => "file"} | |
|
12 |
- %input{:type => " |
|
|
2 | + - if (not Configuration.time_limit_mode?) or (not @user.contest_finished?) | |
|
3 | + .problem-form{:id => "problem-form-#{problem.id}"} | |
|
4 | + - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do | |
|
5 | + %b Input: | |
|
6 | + %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"} | |
|
7 | + %span{:id => "problem-timing-message-#{problem.id}"} | |
|
8 | + = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit." | |
|
9 | + %div{:id => "problem-submission-form-#{problem.id}"} | |
|
10 | + - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do | |
|
11 | + %b Submit output: | |
|
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 | 19 | .problem-description |
|
15 | 20 | - if problem.description!=nil |
@@ -9,7 +9,7 | |||
|
9 | 9 | # |
|
10 | 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 | 14 | create_table "announcements", :force => true do |t| |
|
15 | 15 | t.string "author" |
@@ -186,8 +186,8 | |||
|
186 | 186 | |
|
187 | 187 | create_table "test_pairs", :force => true do |t| |
|
188 | 188 | t.integer "problem_id" |
|
189 | - t.text "input" | |
|
190 | - t.text "solution" | |
|
189 | + t.text "input", :limit => 16777215 | |
|
190 | + t.text "solution", :limit => 16777215 | |
|
191 | 191 | t.datetime "created_at" |
|
192 | 192 | t.datetime "updated_at" |
|
193 | 193 | t.integer "number" |
You need to be logged in to leave comments.
Login now