Description:
added options not to hide passed problems
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r260:a6455c18d017 - - 2 files changed: 5 inserted, 1 deleted
@@ -1,490 +1,493 | |||
|
1 | 1 | class MainController < ApplicationController |
|
2 | 2 | |
|
3 | 3 | before_filter :authenticate, :except => [:index, :login] |
|
4 | 4 | before_filter :check_viewability, :except => [:index, :login] |
|
5 | 5 | |
|
6 | 6 | append_before_filter :update_user_start_time, :except => [:index, :login] |
|
7 | 7 | |
|
8 | 8 | # to prevent log in box to be shown when user logged out of the |
|
9 | 9 | # system only in some tab |
|
10 | 10 | prepend_before_filter :reject_announcement_refresh_when_logged_out, :only => [:announcements] |
|
11 | 11 | |
|
12 | 12 | # COMMENTED OUT: filter in each action instead |
|
13 | 13 | # before_filter :verify_time_limit, :only => [:submit] |
|
14 | 14 | |
|
15 | 15 | verify :method => :post, :only => [:submit, :download_input, :submit_solution], |
|
16 | 16 | :redirect_to => { :action => :index } |
|
17 | 17 | |
|
18 | 18 | # COMMENT OUT: only need when having high load |
|
19 | 19 | # caches_action :index, :login |
|
20 | 20 | |
|
21 | 21 | # NOTE: This method is not actually needed, 'config/routes.rb' has |
|
22 | 22 | # assigned action login as a default action. |
|
23 | 23 | def index |
|
24 | 24 | redirect_to :action => 'login' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | def login |
|
28 | 28 | saved_notice = flash[:notice] |
|
29 | 29 | reset_session |
|
30 | 30 | flash.now[:notice] = saved_notice |
|
31 | 31 | |
|
32 | 32 | # EXPERIMENT: |
|
33 | 33 | # Hide login if in single user mode and the url does not |
|
34 | 34 | # explicitly specify /login |
|
35 | 35 | # |
|
36 | 36 | # logger.info "PATH: #{request.path}" |
|
37 | 37 | # if Configuration['system.single_user_mode'] and |
|
38 | 38 | # request.path!='/main/login' |
|
39 | 39 | # @hidelogin = true |
|
40 | 40 | # end |
|
41 | 41 | |
|
42 | 42 | @announcements = Announcement.find_for_frontpage |
|
43 | 43 | render :action => 'login', :layout => 'empty' |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | def list |
|
47 | 47 | prepare_list_information |
|
48 | 48 | end |
|
49 | 49 | |
|
50 | 50 | def help |
|
51 | 51 | @user = User.find(session[:user_id]) |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | def submit |
|
55 | 55 | user = User.find(session[:user_id]) |
|
56 | 56 | |
|
57 | 57 | @submission = Submission.new(params[:submission]) |
|
58 | 58 | @submission.user = user |
|
59 | 59 | @submission.language_id = 0 |
|
60 | 60 | if (params['file']) and (params['file']!='') |
|
61 | 61 | @submission.source = params['file'].read |
|
62 | 62 | @submission.source_filename = params['file'].original_filename |
|
63 | 63 | end |
|
64 | 64 | @submission.submitted_at = Time.new.gmtime |
|
65 | 65 | |
|
66 | 66 | if Configuration.time_limit_mode? and user.contest_finished? |
|
67 | 67 | @submission.errors.add_to_base "The contest is over." |
|
68 | 68 | prepare_list_information |
|
69 | 69 | render :action => 'list' and return |
|
70 | 70 | end |
|
71 | 71 | |
|
72 | 72 | if @submission.valid? |
|
73 | 73 | if @submission.save == false |
|
74 | 74 | flash[:notice] = 'Error saving your submission' |
|
75 | 75 | elsif Task.create(:submission_id => @submission.id, |
|
76 | 76 | :status => Task::STATUS_INQUEUE) == false |
|
77 | 77 | flash[:notice] = 'Error adding your submission to task queue' |
|
78 | 78 | end |
|
79 | 79 | else |
|
80 | 80 | prepare_list_information |
|
81 | 81 | render :action => 'list' and return |
|
82 | 82 | end |
|
83 | 83 | redirect_to :action => 'list' |
|
84 | 84 | end |
|
85 | 85 | |
|
86 | 86 | def source |
|
87 | 87 | submission = Submission.find(params[:id]) |
|
88 | 88 | if submission.user_id == session[:user_id] |
|
89 | 89 | send_data(submission.source, |
|
90 | 90 | {:filename => submission.download_filename, |
|
91 | 91 | :type => 'text/plain'}) |
|
92 | 92 | else |
|
93 | 93 | flash[:notice] = 'Error viewing source' |
|
94 | 94 | redirect_to :action => 'list' |
|
95 | 95 | end |
|
96 | 96 | end |
|
97 | 97 | |
|
98 | 98 | def compiler_msg |
|
99 | 99 | @submission = Submission.find(params[:id]) |
|
100 | 100 | if @submission.user_id == session[:user_id] |
|
101 | 101 | render :action => 'compiler_msg', :layout => 'empty' |
|
102 | 102 | else |
|
103 | 103 | flash[:notice] = 'Error viewing source' |
|
104 | 104 | redirect_to :action => 'list' |
|
105 | 105 | end |
|
106 | 106 | end |
|
107 | 107 | |
|
108 | 108 | def submission |
|
109 | 109 | # protect the action for Code Jom |
|
110 | 110 | redirect_to :action => 'list' |
|
111 | 111 | |
|
112 | 112 | @user = User.find(session[:user_id]) |
|
113 | 113 | @problems = Problem.find_available_problems |
|
114 | 114 | if params[:id]==nil |
|
115 | 115 | @problem = nil |
|
116 | 116 | @submissions = nil |
|
117 | 117 | else |
|
118 | 118 | @problem = Problem.find_by_name(params[:id]) |
|
119 | 119 | if not @problem.available |
|
120 | 120 | redirect_to :action => 'list' |
|
121 | 121 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
122 | 122 | return |
|
123 | 123 | end |
|
124 | 124 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
125 | 125 | end |
|
126 | 126 | end |
|
127 | 127 | |
|
128 | 128 | def result |
|
129 | 129 | if !Configuration.show_grading_result |
|
130 | 130 | redirect_to :action => 'list' and return |
|
131 | 131 | end |
|
132 | 132 | @user = User.find(session[:user_id]) |
|
133 | 133 | @submission = Submission.find(params[:id]) |
|
134 | 134 | if @submission.user!=@user |
|
135 | 135 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
136 | 136 | redirect_to :action => 'list' and return |
|
137 | 137 | end |
|
138 | 138 | prepare_grading_result(@submission) |
|
139 | 139 | end |
|
140 | 140 | |
|
141 | 141 | def load_output |
|
142 | 142 | if !Configuration.show_grading_result or params[:num]==nil |
|
143 | 143 | redirect_to :action => 'list' and return |
|
144 | 144 | end |
|
145 | 145 | @user = User.find(session[:user_id]) |
|
146 | 146 | @submission = Submission.find(params[:id]) |
|
147 | 147 | if @submission.user!=@user |
|
148 | 148 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
149 | 149 | redirect_to :action => 'list' and return |
|
150 | 150 | end |
|
151 | 151 | case_num = params[:num].to_i |
|
152 | 152 | out_filename = output_filename(@user.login, |
|
153 | 153 | @submission.problem.name, |
|
154 | 154 | @submission.id, |
|
155 | 155 | case_num) |
|
156 | 156 | if !FileTest.exists?(out_filename) |
|
157 | 157 | flash[:notice] = 'Output not found.' |
|
158 | 158 | redirect_to :action => 'list' and return |
|
159 | 159 | end |
|
160 | 160 | |
|
161 | 161 | response.headers['Content-Type'] = "application/force-download" |
|
162 | 162 | response.headers['Content-Disposition'] = "attachment; filename=\"output-#{case_num}.txt\"" |
|
163 | 163 | response.headers["X-Sendfile"] = out_filename |
|
164 | 164 | response.headers['Content-length'] = File.size(out_filename) |
|
165 | 165 | render :nothing => true |
|
166 | 166 | end |
|
167 | 167 | |
|
168 | 168 | def error |
|
169 | 169 | @user = User.find(session[:user_id]) |
|
170 | 170 | end |
|
171 | 171 | |
|
172 | 172 | # announcement refreshing and hiding methods |
|
173 | 173 | |
|
174 | 174 | def announcements |
|
175 | 175 | if params.has_key? 'recent' |
|
176 | 176 | prepare_announcements(params[:recent]) |
|
177 | 177 | else |
|
178 | 178 | prepare_announcements |
|
179 | 179 | end |
|
180 | 180 | render(:partial => 'announcement', |
|
181 | 181 | :collection => @announcements, |
|
182 | 182 | :locals => {:announcement_effect => true}) |
|
183 | 183 | end |
|
184 | 184 | |
|
185 | 185 | # |
|
186 | 186 | # actions for Code Jom |
|
187 | 187 | # |
|
188 | 188 | def download_input |
|
189 | 189 | user = User.find(session[:user_id]) |
|
190 | 190 | |
|
191 | 191 | if Configuration.time_limit_mode? and user.contest_finished? |
|
192 | 192 | redirect_to :action => 'list' and return |
|
193 | 193 | end |
|
194 | 194 | |
|
195 | 195 | problem = Problem.find(params[:id]) |
|
196 | 196 | if user.can_request_new_test_pair_for? problem |
|
197 | 197 | assignment = user.get_new_test_pair_assignment_for problem |
|
198 | 198 | assignment.save |
|
199 | 199 | |
|
200 | 200 | send_data(assignment.test_pair.input, |
|
201 | 201 | { :filename => "#{problem.name}-#{assignment.request_number}.in", |
|
202 | 202 | :type => 'text/plain' }) |
|
203 | 203 | else |
|
204 | 204 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
205 | 205 | send_data(recent_assignment.test_pair.input, |
|
206 | 206 | { :filename => "#{problem.name}-#{recent_assignment.request_number}.in", |
|
207 | 207 | :type => 'text/plain' }) |
|
208 | 208 | end |
|
209 | 209 | end |
|
210 | 210 | |
|
211 | 211 | def submit_solution |
|
212 | 212 | problem = Problem.find(params[:id]) |
|
213 | 213 | user = User.find(session[:user_id]) |
|
214 | 214 | recent_assignment = user.get_recent_test_pair_assignment_for problem |
|
215 | 215 | |
|
216 | 216 | if Configuration.time_limit_mode? and user.contest_finished? |
|
217 | 217 | redirect_to :action => 'list' and return |
|
218 | 218 | end |
|
219 | 219 | |
|
220 | 220 | if recent_assignment == nil |
|
221 | 221 | flash[:notice] = 'You have not requested for any input data for this problem. Please download an input first.' |
|
222 | 222 | session[:current_problem_id] = problem.id |
|
223 | 223 | redirect_to :action => 'list' and return |
|
224 | 224 | end |
|
225 | 225 | |
|
226 | 226 | if recent_assignment.expired? |
|
227 | 227 | flash[:notice] = 'The current input is expired. Please download a new input data.' |
|
228 | 228 | session[:current_problem_id] = problem.id |
|
229 | 229 | redirect_to :action => 'list' and return |
|
230 | 230 | end |
|
231 | 231 | |
|
232 | 232 | if recent_assignment.submitted |
|
233 | 233 | flash[:notice] = 'You have already submitted an incorrect solution for this input. Please download a new input data.' |
|
234 | 234 | session[:current_problem_id] = problem.id |
|
235 | 235 | redirect_to :action => 'list' and return |
|
236 | 236 | end |
|
237 | 237 | |
|
238 | 238 | if params[:file] == nil |
|
239 | 239 | flash[:notice] = 'You have not submitted any output.' |
|
240 | 240 | session[:current_problem_id] = problem.id |
|
241 | 241 | redirect_to :action => 'list' and return |
|
242 | 242 | end |
|
243 | 243 | |
|
244 | 244 | submitted_solution = params[:file].read |
|
245 | 245 | test_pair = recent_assignment.test_pair |
|
246 | 246 | passed = test_pair.grade(submitted_solution) |
|
247 | 247 | points = passed ? 100 : 0 |
|
248 | 248 | submission = Submission.new(:user => user, |
|
249 | 249 | :problem => problem, |
|
250 | 250 | :source => submitted_solution, |
|
251 | 251 | :source_filename => params['file'].original_filename, |
|
252 | 252 | :language_id => 0, |
|
253 | 253 | :submitted_at => Time.new.gmtime, |
|
254 | 254 | :graded_at => Time.new.gmtime, |
|
255 | 255 | :points => points) |
|
256 | 256 | submission.save |
|
257 | 257 | recent_assignment.submitted = true |
|
258 | 258 | recent_assignment.save |
|
259 | 259 | |
|
260 | 260 | status = user.get_submission_status_for(problem) |
|
261 | 261 | if status == nil |
|
262 | 262 | status = SubmissionStatus.new :user => user, :problem => problem, :submission_count => 0 |
|
263 | 263 | end |
|
264 | 264 | |
|
265 | 265 | status.submission_count += 1 |
|
266 | 266 | status.passed = passed |
|
267 | 267 | status.save |
|
268 | 268 | |
|
269 | 269 | if passed |
|
270 | 270 | flash[:notice] = 'Correct solution.' |
|
271 | 271 | user.update_codejom_status |
|
272 | 272 | else |
|
273 | 273 | session[:current_problem_id] = problem.id |
|
274 | 274 | flash[:notice] = 'Incorrect solution.' |
|
275 | 275 | end |
|
276 | 276 | redirect_to :action => 'list' |
|
277 | 277 | end |
|
278 | 278 | |
|
279 | 279 | def problems |
|
280 | 280 | prepare_list_information |
|
281 | 281 | @page_reload_when_view_problem = true |
|
282 | 282 | render :partial => 'problem_title', :collection => @problems, :as => :problem |
|
283 | 283 | end |
|
284 | 284 | |
|
285 | 285 | def splash |
|
286 | 286 | render :text => '<div class="notice">Most recent task:</span>' |
|
287 | 287 | end |
|
288 | 288 | |
|
289 | 289 | protected |
|
290 | 290 | |
|
291 | 291 | def prepare_announcements(recent=nil) |
|
292 | 292 | if Configuration.show_tasks_to?(@user) |
|
293 | 293 | @announcements = Announcement.find_published(true) |
|
294 | 294 | else |
|
295 | 295 | @announcements = Announcement.find_published |
|
296 | 296 | end |
|
297 | 297 | if recent!=nil |
|
298 | 298 | recent_id = recent.to_i |
|
299 | 299 | @announcements = @announcements.find_all { |a| a.id > recent_id } |
|
300 | 300 | end |
|
301 | 301 | end |
|
302 | 302 | |
|
303 | 303 | def prepare_timeout_information(problems) |
|
304 | 304 | @submission_timeouts = {} |
|
305 | 305 | problems.each do |problem| |
|
306 | 306 | assignment = @user.get_recent_test_pair_assignment_for(problem) |
|
307 | 307 | if assignment == nil |
|
308 | 308 | timeout = nil |
|
309 | 309 | else |
|
310 | 310 | if (assignment.expired?) or (assignment.submitted) |
|
311 | 311 | timeout = 0 |
|
312 | 312 | else |
|
313 | 313 | timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime |
|
314 | 314 | end |
|
315 | 315 | end |
|
316 | 316 | @submission_timeouts[problem.id] = timeout |
|
317 | 317 | end |
|
318 | - @submission_timeouts.each_pair {|k,v| puts "#{k} => #{v}"} | |
|
319 | 318 | end |
|
320 | 319 | |
|
321 | 320 | def prepare_list_information |
|
322 | 321 | @user = User.find(session[:user_id]) |
|
323 | 322 | |
|
324 | 323 | all_problems = Problem.find_available_problems |
|
325 | 324 | |
|
326 | 325 | passed = {} |
|
327 | 326 | sub_count = {} |
|
328 | 327 | @user.submission_statuses.each do |status| |
|
329 | 328 | if status.passed |
|
330 | 329 | passed[status.problem_id] = true |
|
331 | 330 | end |
|
332 | 331 | sub_count[status.problem_id] = status.submission_count |
|
333 | 332 | end |
|
334 | 333 | |
|
335 | 334 | if session.has_key? :current_problem_id |
|
336 | 335 | @current_problem_id = session[:current_problem_id] |
|
337 | 336 | session.delete(:current_problem_id) |
|
338 | 337 | else |
|
339 | 338 | if params.has_key? :id |
|
340 | 339 | @current_problem_id = params[:id].to_i |
|
341 | 340 | else |
|
342 | 341 | @current_problem_id = nil |
|
343 | 342 | end |
|
344 | 343 | end |
|
345 | 344 | |
|
345 | + if (not defined? HIDE_PASSED_TASKS) or HIDE_PASSED_TASKS | |
|
346 | 346 | @problems = all_problems.reject { |problem| passed.has_key? problem.id } |
|
347 | + else | |
|
348 | + @problems = all_problems | |
|
349 | + end | |
|
347 | 350 | |
|
348 | 351 | prepare_timeout_information(@problems) |
|
349 | 352 | |
|
350 | 353 | @prob_submissions = Array.new |
|
351 | 354 | @problems.each do |p| |
|
352 | 355 | if sub_count.has_key? p.id |
|
353 | 356 | @prob_submissions << { :count => sub_count[p.id] } |
|
354 | 357 | else |
|
355 | 358 | @prob_submissions << { :count => 0 } |
|
356 | 359 | end |
|
357 | 360 | end |
|
358 | 361 | prepare_announcements |
|
359 | 362 | end |
|
360 | 363 | |
|
361 | 364 | def check_viewability |
|
362 | 365 | @user = User.find(session[:user_id]) |
|
363 | 366 | if (!Configuration.show_tasks_to?(@user)) and |
|
364 | 367 | ((action_name=='submission') or (action_name=='submit')) |
|
365 | 368 | redirect_to :action => 'list' and return |
|
366 | 369 | end |
|
367 | 370 | end |
|
368 | 371 | |
|
369 | 372 | def prepare_grading_result(submission) |
|
370 | 373 | if Configuration.task_grading_info.has_key? submission.problem.name |
|
371 | 374 | grading_info = Configuration.task_grading_info[submission.problem.name] |
|
372 | 375 | else |
|
373 | 376 | # guess task info from problem.full_score |
|
374 | 377 | cases = submission.problem.full_score / 10 |
|
375 | 378 | grading_info = { |
|
376 | 379 | 'testruns' => cases, |
|
377 | 380 | 'testcases' => cases |
|
378 | 381 | } |
|
379 | 382 | end |
|
380 | 383 | @test_runs = [] |
|
381 | 384 | if grading_info['testruns'].is_a? Integer |
|
382 | 385 | trun_count = grading_info['testruns'] |
|
383 | 386 | trun_count.times do |i| |
|
384 | 387 | @test_runs << [ read_grading_result(@user.login, |
|
385 | 388 | submission.problem.name, |
|
386 | 389 | submission.id, |
|
387 | 390 | i+1) ] |
|
388 | 391 | end |
|
389 | 392 | else |
|
390 | 393 | grading_info['testruns'].keys.sort.each do |num| |
|
391 | 394 | run = [] |
|
392 | 395 | testrun = grading_info['testruns'][num] |
|
393 | 396 | testrun.each do |c| |
|
394 | 397 | run << read_grading_result(@user.login, |
|
395 | 398 | submission.problem.name, |
|
396 | 399 | submission.id, |
|
397 | 400 | c) |
|
398 | 401 | end |
|
399 | 402 | @test_runs << run |
|
400 | 403 | end |
|
401 | 404 | end |
|
402 | 405 | end |
|
403 | 406 | |
|
404 | 407 | def grading_result_dir(user_name, problem_name, submission_id, case_num) |
|
405 | 408 | return "#{GRADING_RESULT_DIR}/#{user_name}/#{problem_name}/#{submission_id}/test-result/#{case_num}" |
|
406 | 409 | end |
|
407 | 410 | |
|
408 | 411 | def output_filename(user_name, problem_name, submission_id, case_num) |
|
409 | 412 | dir = grading_result_dir(user_name,problem_name, submission_id, case_num) |
|
410 | 413 | return "#{dir}/output.txt" |
|
411 | 414 | end |
|
412 | 415 | |
|
413 | 416 | def read_grading_result(user_name, problem_name, submission_id, case_num) |
|
414 | 417 | dir = grading_result_dir(user_name,problem_name, submission_id, case_num) |
|
415 | 418 | result_file_name = "#{dir}/result" |
|
416 | 419 | if !FileTest.exists?(result_file_name) |
|
417 | 420 | return {:num => case_num, :msg => 'program did not run'} |
|
418 | 421 | else |
|
419 | 422 | results = File.open(result_file_name).readlines |
|
420 | 423 | run_stat = extract_running_stat(results) |
|
421 | 424 | output_filename = "#{dir}/output.txt" |
|
422 | 425 | if FileTest.exists?(output_filename) |
|
423 | 426 | output_file = true |
|
424 | 427 | output_size = File.size(output_filename) |
|
425 | 428 | else |
|
426 | 429 | output_file = false |
|
427 | 430 | output_size = 0 |
|
428 | 431 | end |
|
429 | 432 | |
|
430 | 433 | return { |
|
431 | 434 | :num => case_num, |
|
432 | 435 | :msg => results[0], |
|
433 | 436 | :run_stat => run_stat, |
|
434 | 437 | :output => output_file, |
|
435 | 438 | :output_size => output_size |
|
436 | 439 | } |
|
437 | 440 | end |
|
438 | 441 | end |
|
439 | 442 | |
|
440 | 443 | # copied from grader/script/lib/test_request_helper.rb |
|
441 | 444 | def extract_running_stat(results) |
|
442 | 445 | running_stat_line = results[-1] |
|
443 | 446 | |
|
444 | 447 | # extract exit status line |
|
445 | 448 | run_stat = "" |
|
446 | 449 | if !(/[Cc]orrect/.match(results[0])) |
|
447 | 450 | run_stat = results[0].chomp |
|
448 | 451 | else |
|
449 | 452 | run_stat = 'Program exited normally' |
|
450 | 453 | end |
|
451 | 454 | |
|
452 | 455 | logger.info "Stat line: #{running_stat_line}" |
|
453 | 456 | |
|
454 | 457 | # extract running time |
|
455 | 458 | if res = /r(.*)u(.*)s/.match(running_stat_line) |
|
456 | 459 | seconds = (res[1].to_f + res[2].to_f) |
|
457 | 460 | time_stat = "Time used: #{seconds} sec." |
|
458 | 461 | else |
|
459 | 462 | seconds = nil |
|
460 | 463 | time_stat = "Time used: n/a sec." |
|
461 | 464 | end |
|
462 | 465 | |
|
463 | 466 | # extract memory usage |
|
464 | 467 | if res = /s(.*)m/.match(running_stat_line) |
|
465 | 468 | memory_used = res[1].to_i |
|
466 | 469 | else |
|
467 | 470 | memory_used = -1 |
|
468 | 471 | end |
|
469 | 472 | |
|
470 | 473 | return { |
|
471 | 474 | :msg => "#{run_stat}\n#{time_stat}", |
|
472 | 475 | :running_time => seconds, |
|
473 | 476 | :exit_status => run_stat, |
|
474 | 477 | :memory_usage => memory_used |
|
475 | 478 | } |
|
476 | 479 | end |
|
477 | 480 | |
|
478 | 481 | def update_user_start_time |
|
479 | 482 | user = User.find(session[:user_id]) |
|
480 | 483 | UserContestStat.update_user_start_time(user) |
|
481 | 484 | end |
|
482 | 485 | |
|
483 | 486 | def reject_announcement_refresh_when_logged_out |
|
484 | 487 | if not session[:user_id] |
|
485 | 488 | render :text => 'Access forbidden', :status => 403 |
|
486 | 489 | end |
|
487 | 490 | end |
|
488 | 491 | |
|
489 | 492 | end |
|
490 | 493 |
@@ -1,111 +1,112 | |||
|
1 | 1 | # Be sure to restart your web server when you modify this file. |
|
2 | 2 | |
|
3 | 3 | # Uncomment below to force Rails into production mode when |
|
4 | 4 | # you don't control web/app server and can't set it the proper way |
|
5 | 5 | # ENV['RAILS_ENV'] ||= 'production' |
|
6 | 6 | |
|
7 | 7 | # Specifies gem version of Rails to use when vendor/rails is not present |
|
8 | 8 | RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION |
|
9 | 9 | |
|
10 | 10 | # Bootstrap the Rails environment, frameworks, and default configuration |
|
11 | 11 | require File.join(File.dirname(__FILE__), 'boot') |
|
12 | 12 | |
|
13 | 13 | Rails::Initializer.run do |config| |
|
14 | 14 | # Settings in config/environments/* take precedence over those specified here |
|
15 | 15 | |
|
16 | 16 | # Skip frameworks you're not going to use (only works if using vendor/rails) |
|
17 | 17 | # config.frameworks -= [ :action_web_service, :action_mailer ] |
|
18 | 18 | |
|
19 | 19 | # Only load the plugins named here, by default all plugins in vendor/plugins are loaded |
|
20 | 20 | # config.plugins = %W( exception_notification ssl_requirement ) |
|
21 | 21 | |
|
22 | 22 | # Add additional load paths for your own custom dirs |
|
23 | 23 | # config.load_paths += %W( #{RAILS_ROOT}/extras ) |
|
24 | 24 | |
|
25 | 25 | # Force all environments to use the same logger level |
|
26 | 26 | # (by default production uses :info, the others :debug) |
|
27 | 27 | # config.log_level = :debug |
|
28 | 28 | |
|
29 | 29 | # Use the database for sessions instead of the file system |
|
30 | 30 | # (create the session table with 'rake db:sessions:create') |
|
31 | 31 | config.action_controller.session_store = :active_record_store |
|
32 | 32 | |
|
33 | 33 | # Use SQL instead of Active Record's schema dumper when creating the test database. |
|
34 | 34 | # This is necessary if your schema can't be completely dumped by the schema dumper, |
|
35 | 35 | # like if you have constraints or database-specific column types |
|
36 | 36 | # config.active_record.schema_format = :sql |
|
37 | 37 | |
|
38 | 38 | # Activate observers that should always be running |
|
39 | 39 | # config.active_record.observers = :cacher, :garbage_collector |
|
40 | 40 | |
|
41 | 41 | # Make Active Record use UTC-base instead of local time |
|
42 | 42 | config.time_zone = 'UTC' |
|
43 | 43 | |
|
44 | 44 | # Setting locales |
|
45 | 45 | config.i18n.default_locale = 'en' |
|
46 | 46 | |
|
47 | 47 | # See Rails::Configuration for more options |
|
48 | 48 | |
|
49 | 49 | # ------------- |
|
50 | 50 | # Required gems |
|
51 | 51 | # ------------- |
|
52 | 52 | config.gem "haml" |
|
53 | 53 | config.gem "tmail" |
|
54 | 54 | config.gem "rdiscount", :lib => "rdiscount" |
|
55 | 55 | |
|
56 | 56 | # NOTES on rspec: if you wan to test with rspec, you have to install |
|
57 | 57 | # rspec yourself, just call: [sudo] gem install rspec-rails |
|
58 | 58 | |
|
59 | 59 | end |
|
60 | 60 | |
|
61 | 61 | # Add new inflection rules using the following format |
|
62 | 62 | # (all these examples are active by default): |
|
63 | 63 | # Inflector.inflections do |inflect| |
|
64 | 64 | # inflect.plural /^(ox)$/i, '\1en' |
|
65 | 65 | # inflect.singular /^(ox)en/i, '\1' |
|
66 | 66 | # inflect.irregular 'person', 'people' |
|
67 | 67 | # inflect.uncountable %w( fish sheep ) |
|
68 | 68 | # end |
|
69 | 69 | |
|
70 | 70 | # Add new mime types for use in respond_to blocks: |
|
71 | 71 | # Mime::Type.register "text/richtext", :rtf |
|
72 | 72 | # Mime::Type.register "application/x-mobile", :mobile |
|
73 | 73 | |
|
74 | 74 | # Include your application configuration below |
|
75 | 75 | |
|
76 | 76 | # If you want to manage graders through web interface, set the path to |
|
77 | 77 | # the grader directory below. This dir is where raw, ev, ev-exam, |
|
78 | 78 | # scripts reside. All grader scripts will be in |
|
79 | 79 | # #{GRADER_ROOT_DIR}/scripts. |
|
80 | 80 | GRADER_ROOT_DIR = '' |
|
81 | 81 | |
|
82 | 82 | # These are where inputs and outputs of test requests are stored |
|
83 | 83 | TEST_REQUEST_INPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/input' |
|
84 | 84 | TEST_REQUEST_OUTPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/output' |
|
85 | 85 | |
|
86 | 86 | # To use ANALYSIS MODE, provide the testcases/testruns breakdown, |
|
87 | 87 | # and the directory of the grading result (usually in judge's dir). |
|
88 | 88 | TASK_GRADING_INFO_FILENAME = RAILS_ROOT + '/config/tasks.yml' |
|
89 | 89 | |
|
90 | 90 | # TODO: change this to where results are kept. |
|
91 | 91 | GRADING_RESULT_DIR = 'RESULT-DIR' |
|
92 | 92 | |
|
93 | 93 | # Change this to allow importing testdata into database as test-pairs. |
|
94 | 94 | # This is mainly for Code Jom contest. |
|
95 | 95 | ALLOW_TEST_PAIR_IMPORT = false |
|
96 | 96 | |
|
97 | 97 | # Uncomment so that the system validates user e-mails |
|
98 | 98 | # VALIDATE_USER_EMAILS = true |
|
99 | 99 | |
|
100 | 100 | # Uncomment so that Apache X-Sendfile is used when delivering files |
|
101 | 101 | # (e.g., in /tasks/view). |
|
102 | 102 | # USE_APACHE_XSENDFILE = true |
|
103 | 103 | |
|
104 | 104 | # Uncomment so that configuration is read only once when the server is loaded |
|
105 | 105 | # Configuration.enable_caching |
|
106 | 106 | |
|
107 | 107 | # OPTIONS FOR CODE JOM |
|
108 | 108 | # -------------------- |
|
109 | 109 | CODEJOM_MAX_ALIVE_LEVEL = 10 |
|
110 | 110 | TEST_ASSIGNMENT_EXPIRATION_DURATION = 5.minute |
|
111 | 111 | SHOW_CONTEST_STATUS = false |
|
112 | + HIDE_PASSED_TASKS = true No newline at end of file |
You need to be logged in to leave comments.
Login now