Description:
added options not to hide passed problems
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r260:a6455c18d017 - - 2 files changed: 5 inserted, 1 deleted

@@ -294,77 +294,80
294 else
294 else
295 @announcements = Announcement.find_published
295 @announcements = Announcement.find_published
296 end
296 end
297 if recent!=nil
297 if recent!=nil
298 recent_id = recent.to_i
298 recent_id = recent.to_i
299 @announcements = @announcements.find_all { |a| a.id > recent_id }
299 @announcements = @announcements.find_all { |a| a.id > recent_id }
300 end
300 end
301 end
301 end
302
302
303 def prepare_timeout_information(problems)
303 def prepare_timeout_information(problems)
304 @submission_timeouts = {}
304 @submission_timeouts = {}
305 problems.each do |problem|
305 problems.each do |problem|
306 assignment = @user.get_recent_test_pair_assignment_for(problem)
306 assignment = @user.get_recent_test_pair_assignment_for(problem)
307 if assignment == nil
307 if assignment == nil
308 timeout = nil
308 timeout = nil
309 else
309 else
310 if (assignment.expired?) or (assignment.submitted)
310 if (assignment.expired?) or (assignment.submitted)
311 timeout = 0
311 timeout = 0
312 else
312 else
313 timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime
313 timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime
314 end
314 end
315 end
315 end
316 @submission_timeouts[problem.id] = timeout
316 @submission_timeouts[problem.id] = timeout
317 end
317 end
318 - @submission_timeouts.each_pair {|k,v| puts "#{k} => #{v}"}
319 end
318 end
320
319
321 def prepare_list_information
320 def prepare_list_information
322 @user = User.find(session[:user_id])
321 @user = User.find(session[:user_id])
323
322
324 all_problems = Problem.find_available_problems
323 all_problems = Problem.find_available_problems
325
324
326 passed = {}
325 passed = {}
327 sub_count = {}
326 sub_count = {}
328 @user.submission_statuses.each do |status|
327 @user.submission_statuses.each do |status|
329 if status.passed
328 if status.passed
330 passed[status.problem_id] = true
329 passed[status.problem_id] = true
331 end
330 end
332 sub_count[status.problem_id] = status.submission_count
331 sub_count[status.problem_id] = status.submission_count
333 end
332 end
334
333
335 if session.has_key? :current_problem_id
334 if session.has_key? :current_problem_id
336 @current_problem_id = session[:current_problem_id]
335 @current_problem_id = session[:current_problem_id]
337 session.delete(:current_problem_id)
336 session.delete(:current_problem_id)
338 else
337 else
339 if params.has_key? :id
338 if params.has_key? :id
340 @current_problem_id = params[:id].to_i
339 @current_problem_id = params[:id].to_i
341 else
340 else
342 @current_problem_id = nil
341 @current_problem_id = nil
343 end
342 end
344 end
343 end
345
344
345 + if (not defined? HIDE_PASSED_TASKS) or HIDE_PASSED_TASKS
346 @problems = all_problems.reject { |problem| passed.has_key? problem.id }
346 @problems = all_problems.reject { |problem| passed.has_key? problem.id }
347 + else
348 + @problems = all_problems
349 + end
347
350
348 prepare_timeout_information(@problems)
351 prepare_timeout_information(@problems)
349
352
350 @prob_submissions = Array.new
353 @prob_submissions = Array.new
351 @problems.each do |p|
354 @problems.each do |p|
352 if sub_count.has_key? p.id
355 if sub_count.has_key? p.id
353 @prob_submissions << { :count => sub_count[p.id] }
356 @prob_submissions << { :count => sub_count[p.id] }
354 else
357 else
355 @prob_submissions << { :count => 0 }
358 @prob_submissions << { :count => 0 }
356 end
359 end
357 end
360 end
358 prepare_announcements
361 prepare_announcements
359 end
362 end
360
363
361 def check_viewability
364 def check_viewability
362 @user = User.find(session[:user_id])
365 @user = User.find(session[:user_id])
363 if (!Configuration.show_tasks_to?(@user)) and
366 if (!Configuration.show_tasks_to?(@user)) and
364 ((action_name=='submission') or (action_name=='submit'))
367 ((action_name=='submission') or (action_name=='submit'))
365 redirect_to :action => 'list' and return
368 redirect_to :action => 'list' and return
366 end
369 end
367 end
370 end
368
371
369 def prepare_grading_result(submission)
372 def prepare_grading_result(submission)
370 if Configuration.task_grading_info.has_key? submission.problem.name
373 if Configuration.task_grading_info.has_key? submission.problem.name
@@ -88,24 +88,25
88 TASK_GRADING_INFO_FILENAME = RAILS_ROOT + '/config/tasks.yml'
88 TASK_GRADING_INFO_FILENAME = RAILS_ROOT + '/config/tasks.yml'
89
89
90 # TODO: change this to where results are kept.
90 # TODO: change this to where results are kept.
91 GRADING_RESULT_DIR = 'RESULT-DIR'
91 GRADING_RESULT_DIR = 'RESULT-DIR'
92
92
93 # Change this to allow importing testdata into database as test-pairs.
93 # Change this to allow importing testdata into database as test-pairs.
94 # This is mainly for Code Jom contest.
94 # This is mainly for Code Jom contest.
95 ALLOW_TEST_PAIR_IMPORT = false
95 ALLOW_TEST_PAIR_IMPORT = false
96
96
97 # Uncomment so that the system validates user e-mails
97 # Uncomment so that the system validates user e-mails
98 # VALIDATE_USER_EMAILS = true
98 # VALIDATE_USER_EMAILS = true
99
99
100 # Uncomment so that Apache X-Sendfile is used when delivering files
100 # Uncomment so that Apache X-Sendfile is used when delivering files
101 # (e.g., in /tasks/view).
101 # (e.g., in /tasks/view).
102 # USE_APACHE_XSENDFILE = true
102 # USE_APACHE_XSENDFILE = true
103
103
104 # Uncomment so that configuration is read only once when the server is loaded
104 # Uncomment so that configuration is read only once when the server is loaded
105 # Configuration.enable_caching
105 # Configuration.enable_caching
106
106
107 # OPTIONS FOR CODE JOM
107 # OPTIONS FOR CODE JOM
108 # --------------------
108 # --------------------
109 CODEJOM_MAX_ALIVE_LEVEL = 10
109 CODEJOM_MAX_ALIVE_LEVEL = 10
110 TEST_ASSIGNMENT_EXPIRATION_DURATION = 5.minute
110 TEST_ASSIGNMENT_EXPIRATION_DURATION = 5.minute
111 SHOW_CONTEST_STATUS = false
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