Description:
added time out check for code jom submissions
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r242:803c8843ad9b - - 3 files changed: 18 inserted, 4 deleted

@@ -87,214 +87,223
87 flash[:notice] = 'Error viewing source'
87 flash[:notice] = 'Error viewing source'
88 redirect_to :action => 'list'
88 redirect_to :action => 'list'
89 end
89 end
90 end
90 end
91
91
92 def compiler_msg
92 def compiler_msg
93 @submission = Submission.find(params[:id])
93 @submission = Submission.find(params[:id])
94 if @submission.user_id == session[:user_id]
94 if @submission.user_id == session[:user_id]
95 render :action => 'compiler_msg', :layout => 'empty'
95 render :action => 'compiler_msg', :layout => 'empty'
96 else
96 else
97 flash[:notice] = 'Error viewing source'
97 flash[:notice] = 'Error viewing source'
98 redirect_to :action => 'list'
98 redirect_to :action => 'list'
99 end
99 end
100 end
100 end
101
101
102 def submission
102 def submission
103 # protect the action for Code Jom
103 # protect the action for Code Jom
104 redirect_to :action => 'list'
104 redirect_to :action => 'list'
105
105
106 @user = User.find(session[:user_id])
106 @user = User.find(session[:user_id])
107 @problems = Problem.find_available_problems
107 @problems = Problem.find_available_problems
108 if params[:id]==nil
108 if params[:id]==nil
109 @problem = nil
109 @problem = nil
110 @submissions = nil
110 @submissions = nil
111 else
111 else
112 @problem = Problem.find_by_name(params[:id])
112 @problem = Problem.find_by_name(params[:id])
113 if not @problem.available
113 if not @problem.available
114 redirect_to :action => 'list'
114 redirect_to :action => 'list'
115 flash[:notice] = 'Error: submissions for that problem are not viewable.'
115 flash[:notice] = 'Error: submissions for that problem are not viewable.'
116 return
116 return
117 end
117 end
118 @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id)
118 @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id)
119 end
119 end
120 end
120 end
121
121
122 def result
122 def result
123 if !Configuration.show_grading_result
123 if !Configuration.show_grading_result
124 redirect_to :action => 'list' and return
124 redirect_to :action => 'list' and return
125 end
125 end
126 @user = User.find(session[:user_id])
126 @user = User.find(session[:user_id])
127 @submission = Submission.find(params[:id])
127 @submission = Submission.find(params[:id])
128 if @submission.user!=@user
128 if @submission.user!=@user
129 flash[:notice] = 'You are not allowed to view result of other users.'
129 flash[:notice] = 'You are not allowed to view result of other users.'
130 redirect_to :action => 'list' and return
130 redirect_to :action => 'list' and return
131 end
131 end
132 prepare_grading_result(@submission)
132 prepare_grading_result(@submission)
133 end
133 end
134
134
135 def load_output
135 def load_output
136 if !Configuration.show_grading_result or params[:num]==nil
136 if !Configuration.show_grading_result or params[:num]==nil
137 redirect_to :action => 'list' and return
137 redirect_to :action => 'list' and return
138 end
138 end
139 @user = User.find(session[:user_id])
139 @user = User.find(session[:user_id])
140 @submission = Submission.find(params[:id])
140 @submission = Submission.find(params[:id])
141 if @submission.user!=@user
141 if @submission.user!=@user
142 flash[:notice] = 'You are not allowed to view result of other users.'
142 flash[:notice] = 'You are not allowed to view result of other users.'
143 redirect_to :action => 'list' and return
143 redirect_to :action => 'list' and return
144 end
144 end
145 case_num = params[:num].to_i
145 case_num = params[:num].to_i
146 out_filename = output_filename(@user.login,
146 out_filename = output_filename(@user.login,
147 @submission.problem.name,
147 @submission.problem.name,
148 @submission.id,
148 @submission.id,
149 case_num)
149 case_num)
150 if !FileTest.exists?(out_filename)
150 if !FileTest.exists?(out_filename)
151 flash[:notice] = 'Output not found.'
151 flash[:notice] = 'Output not found.'
152 redirect_to :action => 'list' and return
152 redirect_to :action => 'list' and return
153 end
153 end
154
154
155 response.headers['Content-Type'] = "application/force-download"
155 response.headers['Content-Type'] = "application/force-download"
156 response.headers['Content-Disposition'] = "attachment; filename=\"output-#{case_num}.txt\""
156 response.headers['Content-Disposition'] = "attachment; filename=\"output-#{case_num}.txt\""
157 response.headers["X-Sendfile"] = out_filename
157 response.headers["X-Sendfile"] = out_filename
158 response.headers['Content-length'] = File.size(out_filename)
158 response.headers['Content-length'] = File.size(out_filename)
159 render :nothing => true
159 render :nothing => true
160 end
160 end
161
161
162 def error
162 def error
163 @user = User.find(session[:user_id])
163 @user = User.find(session[:user_id])
164 end
164 end
165
165
166 # announcement refreshing and hiding methods
166 # announcement refreshing and hiding methods
167
167
168 def announcements
168 def announcements
169 if params.has_key? 'recent'
169 if params.has_key? 'recent'
170 prepare_announcements(params[:recent])
170 prepare_announcements(params[:recent])
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
217 if recent_assignment.submitted
226 if recent_assignment.submitted
218 flash[:notice] = 'You have already submitted an incorrect solution for this input. Please download a new input data.'
227 flash[:notice] = 'You have already submitted an incorrect solution for this input. Please download a new input data.'
219 session[:current_problem_id] = problem.id
228 session[:current_problem_id] = problem.id
220 redirect_to :action => 'list' and return
229 redirect_to :action => 'list' and return
221 end
230 end
222
231
223 if params[:file] == nil
232 if params[:file] == nil
224 flash[:notice] = 'You have not submitted any output.'
233 flash[:notice] = 'You have not submitted any output.'
225 session[:current_problem_id] = problem.id
234 session[:current_problem_id] = problem.id
226 redirect_to :action => 'list' and return
235 redirect_to :action => 'list' and return
227 end
236 end
228
237
229 submitted_solution = params[:file].read
238 submitted_solution = params[:file].read
230 test_pair = recent_assignment.test_pair
239 test_pair = recent_assignment.test_pair
231 passed = test_pair.grade(submitted_solution)
240 passed = test_pair.grade(submitted_solution)
232 points = passed ? 100 : 0
241 points = passed ? 100 : 0
233 submission = Submission.new(:user => user,
242 submission = Submission.new(:user => user,
234 :problem => problem,
243 :problem => problem,
235 :source => submitted_solution,
244 :source => submitted_solution,
236 :source_filename => params['file'].original_filename,
245 :source_filename => params['file'].original_filename,
237 :language_id => 0,
246 :language_id => 0,
238 :submitted_at => Time.new.gmtime,
247 :submitted_at => Time.new.gmtime,
239 :graded_at => Time.new.gmtime,
248 :graded_at => Time.new.gmtime,
240 :points => points)
249 :points => points)
241 submission.save
250 submission.save
242 recent_assignment.submitted = true
251 recent_assignment.submitted = true
243 recent_assignment.save
252 recent_assignment.save
244
253
245 status = user.get_submission_status_for(problem)
254 status = user.get_submission_status_for(problem)
246 if status == nil
255 if status == nil
247 status = SubmissionStatus.new :user => user, :problem => problem, :submission_count => 0
256 status = SubmissionStatus.new :user => user, :problem => problem, :submission_count => 0
248 end
257 end
249
258
250 status.submission_count += 1
259 status.submission_count += 1
251 status.passed = passed
260 status.passed = passed
252 status.save
261 status.save
253
262
254 if passed
263 if passed
255 flash[:notice] = 'Correct solution.'
264 flash[:notice] = 'Correct solution.'
256 user.update_codejom_status
265 user.update_codejom_status
257 else
266 else
258 session[:current_problem_id] = problem.id
267 session[:current_problem_id] = problem.id
259 flash[:notice] = 'Incorrect solution.'
268 flash[:notice] = 'Incorrect solution.'
260 end
269 end
261 redirect_to :action => 'list'
270 redirect_to :action => 'list'
262 end
271 end
263
272
264 protected
273 protected
265
274
266 def prepare_announcements(recent=nil)
275 def prepare_announcements(recent=nil)
267 if Configuration.show_tasks_to?(@user)
276 if Configuration.show_tasks_to?(@user)
268 @announcements = Announcement.find_published(true)
277 @announcements = Announcement.find_published(true)
269 else
278 else
270 @announcements = Announcement.find_published
279 @announcements = Announcement.find_published
271 end
280 end
272 if recent!=nil
281 if recent!=nil
273 recent_id = recent.to_i
282 recent_id = recent.to_i
274 @announcements = @announcements.find_all { |a| a.id > recent_id }
283 @announcements = @announcements.find_all { |a| a.id > recent_id }
275 end
284 end
276 end
285 end
277
286
278 def prepare_timeout_information(problems)
287 def prepare_timeout_information(problems)
279 @submission_timeouts = {}
288 @submission_timeouts = {}
280 problems.each do |problem|
289 problems.each do |problem|
281 assignment = @user.get_recent_test_pair_assignment_for(problem)
290 assignment = @user.get_recent_test_pair_assignment_for(problem)
282 if assignment == nil
291 if assignment == nil
283 timeout = nil
292 timeout = nil
284 else
293 else
285 if (assignment.expired?) or (assignment.submitted)
294 if (assignment.expired?) or (assignment.submitted)
286 timeout = 0
295 timeout = 0
287 else
296 else
288 timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime
297 timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime
289 end
298 end
290 end
299 end
291 @submission_timeouts[problem.id] = timeout
300 @submission_timeouts[problem.id] = timeout
292 end
301 end
293 @submission_timeouts.each_pair {|k,v| puts "#{k} => #{v}"}
302 @submission_timeouts.each_pair {|k,v| puts "#{k} => #{v}"}
294 end
303 end
295
304
296 def prepare_list_information
305 def prepare_list_information
297 @user = User.find(session[:user_id])
306 @user = User.find(session[:user_id])
298
307
299 all_problems = Problem.find_available_problems
308 all_problems = Problem.find_available_problems
300
309
@@ -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 + - if (not Configuration.time_limit_mode?) or (not @user.contest_finished?)
2 .problem-form{:id => "problem-form-#{problem.id}"}
3 .problem-form{:id => "problem-form-#{problem.id}"}
3 - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do
4 - form_tag({ :action => 'download_input', :id => problem.id }, :method => :post) do
4 %b Input:
5 %b Input:
5 %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"}
6 %input{:type => "submit", :value => "Download input", :onclick => "CodejomTimeout.updateTimeoutAfterDownloadClick(#{problem.id}); return true;"}
6 %span{:id => "problem-timing-message-#{problem.id}"}
7 %span{:id => "problem-timing-message-#{problem.id}"}
7 = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit."
8 = "After downloading, you have #{TEST_ASSIGNMENT_EXPIRATION_DURATION/60} minutes to submit."
8 %div{:id => "problem-submission-form-#{problem.id}"}
9 %div{:id => "problem-submission-form-#{problem.id}"}
9 - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do
10 - form_tag({ :action => 'submit_solution', :id => problem.id }, :method => :post, :multipart => true) do
10 %b Submit output:
11 %b Submit output:
11 %input{:type => "file", :name => "file"}
12 %input{:type => "file", :name => "file"}
12 %input{:type => "submit", :value => "Submit solution"}
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,248 +1,248
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 => 20100126170609) do
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
25 create_table "codejom_statuses", :force => true do |t|
25 create_table "codejom_statuses", :force => true do |t|
26 t.integer "user_id"
26 t.integer "user_id"
27 t.boolean "alive"
27 t.boolean "alive"
28 t.integer "num_problems_passed"
28 t.integer "num_problems_passed"
29 t.datetime "created_at"
29 t.datetime "created_at"
30 t.datetime "updated_at"
30 t.datetime "updated_at"
31 end
31 end
32
32
33 create_table "configurations", :force => true do |t|
33 create_table "configurations", :force => true do |t|
34 t.string "key"
34 t.string "key"
35 t.string "value_type"
35 t.string "value_type"
36 t.string "value"
36 t.string "value"
37 t.datetime "created_at"
37 t.datetime "created_at"
38 t.datetime "updated_at"
38 t.datetime "updated_at"
39 t.text "description"
39 t.text "description"
40 end
40 end
41
41
42 create_table "countries", :force => true do |t|
42 create_table "countries", :force => true do |t|
43 t.string "name"
43 t.string "name"
44 t.datetime "created_at"
44 t.datetime "created_at"
45 t.datetime "updated_at"
45 t.datetime "updated_at"
46 end
46 end
47
47
48 create_table "descriptions", :force => true do |t|
48 create_table "descriptions", :force => true do |t|
49 t.text "body"
49 t.text "body"
50 t.boolean "markdowned"
50 t.boolean "markdowned"
51 t.datetime "created_at"
51 t.datetime "created_at"
52 t.datetime "updated_at"
52 t.datetime "updated_at"
53 end
53 end
54
54
55 create_table "grader_processes", :force => true do |t|
55 create_table "grader_processes", :force => true do |t|
56 t.string "host", :limit => 20
56 t.string "host", :limit => 20
57 t.integer "pid"
57 t.integer "pid"
58 t.string "mode"
58 t.string "mode"
59 t.boolean "active"
59 t.boolean "active"
60 t.datetime "created_at"
60 t.datetime "created_at"
61 t.datetime "updated_at"
61 t.datetime "updated_at"
62 t.integer "task_id"
62 t.integer "task_id"
63 t.string "task_type"
63 t.string "task_type"
64 t.boolean "terminated"
64 t.boolean "terminated"
65 end
65 end
66
66
67 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
67 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
68
68
69 create_table "languages", :force => true do |t|
69 create_table "languages", :force => true do |t|
70 t.string "name", :limit => 10
70 t.string "name", :limit => 10
71 t.string "pretty_name"
71 t.string "pretty_name"
72 t.string "ext", :limit => 10
72 t.string "ext", :limit => 10
73 t.string "common_ext"
73 t.string "common_ext"
74 end
74 end
75
75
76 create_table "messages", :force => true do |t|
76 create_table "messages", :force => true do |t|
77 t.integer "sender_id"
77 t.integer "sender_id"
78 t.integer "receiver_id"
78 t.integer "receiver_id"
79 t.integer "replying_message_id"
79 t.integer "replying_message_id"
80 t.text "body"
80 t.text "body"
81 t.boolean "replied"
81 t.boolean "replied"
82 t.datetime "created_at"
82 t.datetime "created_at"
83 t.datetime "updated_at"
83 t.datetime "updated_at"
84 end
84 end
85
85
86 create_table "problems", :force => true do |t|
86 create_table "problems", :force => true do |t|
87 t.string "name", :limit => 30
87 t.string "name", :limit => 30
88 t.string "full_name"
88 t.string "full_name"
89 t.integer "full_score"
89 t.integer "full_score"
90 t.date "date_added"
90 t.date "date_added"
91 t.boolean "available"
91 t.boolean "available"
92 t.string "url"
92 t.string "url"
93 t.integer "description_id"
93 t.integer "description_id"
94 t.boolean "test_allowed"
94 t.boolean "test_allowed"
95 t.boolean "output_only"
95 t.boolean "output_only"
96 end
96 end
97
97
98 create_table "rights", :force => true do |t|
98 create_table "rights", :force => true do |t|
99 t.string "name"
99 t.string "name"
100 t.string "controller"
100 t.string "controller"
101 t.string "action"
101 t.string "action"
102 end
102 end
103
103
104 create_table "rights_roles", :id => false, :force => true do |t|
104 create_table "rights_roles", :id => false, :force => true do |t|
105 t.integer "right_id"
105 t.integer "right_id"
106 t.integer "role_id"
106 t.integer "role_id"
107 end
107 end
108
108
109 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
109 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
110
110
111 create_table "roles", :force => true do |t|
111 create_table "roles", :force => true do |t|
112 t.string "name"
112 t.string "name"
113 end
113 end
114
114
115 create_table "roles_users", :id => false, :force => true do |t|
115 create_table "roles_users", :id => false, :force => true do |t|
116 t.integer "role_id"
116 t.integer "role_id"
117 t.integer "user_id"
117 t.integer "user_id"
118 end
118 end
119
119
120 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
120 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
121
121
122 create_table "sessions", :force => true do |t|
122 create_table "sessions", :force => true do |t|
123 t.string "session_id"
123 t.string "session_id"
124 t.text "data"
124 t.text "data"
125 t.datetime "updated_at"
125 t.datetime "updated_at"
126 end
126 end
127
127
128 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
128 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
129 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
129 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
130
130
131 create_table "sites", :force => true do |t|
131 create_table "sites", :force => true do |t|
132 t.string "name"
132 t.string "name"
133 t.boolean "started"
133 t.boolean "started"
134 t.datetime "start_time"
134 t.datetime "start_time"
135 t.datetime "created_at"
135 t.datetime "created_at"
136 t.datetime "updated_at"
136 t.datetime "updated_at"
137 t.integer "country_id"
137 t.integer "country_id"
138 t.string "password"
138 t.string "password"
139 end
139 end
140
140
141 create_table "submission_statuses", :force => true do |t|
141 create_table "submission_statuses", :force => true do |t|
142 t.integer "user_id"
142 t.integer "user_id"
143 t.integer "problem_id"
143 t.integer "problem_id"
144 t.boolean "passed"
144 t.boolean "passed"
145 t.integer "submission_count"
145 t.integer "submission_count"
146 t.datetime "created_at"
146 t.datetime "created_at"
147 t.datetime "updated_at"
147 t.datetime "updated_at"
148 end
148 end
149
149
150 create_table "submissions", :force => true do |t|
150 create_table "submissions", :force => true do |t|
151 t.integer "user_id"
151 t.integer "user_id"
152 t.integer "problem_id"
152 t.integer "problem_id"
153 t.integer "language_id"
153 t.integer "language_id"
154 t.text "source"
154 t.text "source"
155 t.binary "binary"
155 t.binary "binary"
156 t.datetime "submitted_at"
156 t.datetime "submitted_at"
157 t.datetime "compiled_at"
157 t.datetime "compiled_at"
158 t.text "compiler_message"
158 t.text "compiler_message"
159 t.datetime "graded_at"
159 t.datetime "graded_at"
160 t.integer "points"
160 t.integer "points"
161 t.text "grader_comment"
161 t.text "grader_comment"
162 t.integer "number"
162 t.integer "number"
163 t.string "source_filename"
163 t.string "source_filename"
164 end
164 end
165
165
166 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
166 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
167 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
167 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
168
168
169 create_table "tasks", :force => true do |t|
169 create_table "tasks", :force => true do |t|
170 t.integer "submission_id"
170 t.integer "submission_id"
171 t.datetime "created_at"
171 t.datetime "created_at"
172 t.integer "status"
172 t.integer "status"
173 t.datetime "updated_at"
173 t.datetime "updated_at"
174 end
174 end
175
175
176 create_table "test_pair_assignments", :force => true do |t|
176 create_table "test_pair_assignments", :force => true do |t|
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"
203 t.integer "status"
203 t.integer "status"
204 t.datetime "updated_at"
204 t.datetime "updated_at"
205 t.datetime "submitted_at"
205 t.datetime "submitted_at"
206 t.datetime "compiled_at"
206 t.datetime "compiled_at"
207 t.text "compiler_message"
207 t.text "compiler_message"
208 t.datetime "graded_at"
208 t.datetime "graded_at"
209 t.string "grader_comment"
209 t.string "grader_comment"
210 t.datetime "created_at"
210 t.datetime "created_at"
211 t.float "running_time"
211 t.float "running_time"
212 t.string "exit_status"
212 t.string "exit_status"
213 t.integer "memory_usage"
213 t.integer "memory_usage"
214 end
214 end
215
215
216 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
216 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
217
217
218 create_table "user_contest_stats", :force => true do |t|
218 create_table "user_contest_stats", :force => true do |t|
219 t.integer "user_id"
219 t.integer "user_id"
220 t.datetime "started_at"
220 t.datetime "started_at"
221 t.datetime "created_at"
221 t.datetime "created_at"
222 t.datetime "updated_at"
222 t.datetime "updated_at"
223 end
223 end
224
224
225 create_table "users", :force => true do |t|
225 create_table "users", :force => true do |t|
226 t.string "login", :limit => 50
226 t.string "login", :limit => 50
227 t.string "full_name"
227 t.string "full_name"
228 t.string "hashed_password"
228 t.string "hashed_password"
229 t.string "salt", :limit => 5
229 t.string "salt", :limit => 5
230 t.string "alias"
230 t.string "alias"
231 t.string "email"
231 t.string "email"
232 t.integer "site_id"
232 t.integer "site_id"
233 t.integer "country_id"
233 t.integer "country_id"
234 t.boolean "activated", :default => false
234 t.boolean "activated", :default => false
235 t.datetime "created_at"
235 t.datetime "created_at"
236 t.datetime "updated_at"
236 t.datetime "updated_at"
237 t.string "member1_full_name"
237 t.string "member1_full_name"
238 t.string "member2_full_name"
238 t.string "member2_full_name"
239 t.string "member3_full_name"
239 t.string "member3_full_name"
240 t.boolean "high_school"
240 t.boolean "high_school"
241 t.string "member1_school_name"
241 t.string "member1_school_name"
242 t.string "member2_school_name"
242 t.string "member2_school_name"
243 t.string "member3_school_name"
243 t.string "member3_school_name"
244 end
244 end
245
245
246 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
246 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
247
247
248 end
248 end
You need to be logged in to leave comments. Login now