Show More
Commit Description:
finalize multiple_login, change default menu of report to multiple login
Commit Description:
finalize multiple_login, change default menu of report to multiple login
References:
File last commit:
Show/Diff file:
Action:
app/controllers/test_controller.rb | 118 lines | 3.0 KiB | text/x-ruby | RubyLexer |
jittat
moved test interface functionality to test_controller...
r44 class TestController < ApplicationController
jittat
[web] added mode + access control, when sites started/finished...
r122 before_filter :authenticate, :check_viewability
jittat
moved test interface functionality to test_controller...
r44
jittat
[web] added site and time out basic functionality...
r85 #
# COMMENT OUT: filter in each action instead
#
# before_filter :verify_time_limit, :only => [:submit]
jittat
[web] add test result page...
r79 verify :method => :post, :only => [:submit],
jittat
moved test interface functionality to test_controller...
r44 :redirect_to => { :action => :index }
def index
prepare_index_information
end
def submit
@user = User.find(session[:user_id])
jittat
[web] added site and time out basic functionality...
r85
jittat
[web] fixed test_request error when user does not put in any file...
r86 @submitted_test_request = TestRequest.new_from_form_params(@user,params[:test_request])
Jittat Fakcharoenphol
fixed errors on test request: Rails.root is not a string, no errors.length
r341 if ! @submitted_test_request.errors.empty?
jittat
[web] fixed test_request error when user does not put in any file...
r86 prepare_index_information
render :action => 'index' and return
jittat
[web] added site and time out basic functionality...
r85 end
Jittat Fakcharoenphol
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
r320 if GraderConfiguration.time_limit_mode?
Jittat Fakcharoenphol
added individual contest mode
r217 if @user.contest_finished?
jittat
[web] test request stops at 30 min before end, auto refresh grader process status...
r128 @submitted_test_request.errors.add_to_base('Contest is over.')
prepare_index_information
render :action => 'index' and return
end
Jittat Fakcharoenphol
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
r320 if !GraderConfiguration.allow_test_request(@user)
jittat
[web] test request stops at 30 min before end, auto refresh grader process status...
r128 prepare_index_information
flash[:notice] = 'Test request is not allowed during the last 30 minutes'
redirect_to :action => 'index' and return
end
jittat
[web] fixed test_request error when user does not put in any file...
r86 end
if @submitted_test_request.save
jittat
moved test interface functionality to test_controller...
r44 redirect_to :action => 'index'
else
jittat
[web] fixed test_request error when user does not put in any file...
r86 prepare_index_information
render :action => 'index'
jittat
moved test interface functionality to test_controller...
r44 end
end
def read
user = User.find(session[:user_id])
jittat
[web] add test result page...
r79 begin
test_request = TestRequest.find(params[:id])
rescue
test_request = nil
end
if test_request==nil or test_request.user_id != user.id
jittat
moved test interface functionality to test_controller...
r44 flash[:notice] = 'Invalid output'
redirect_to :action => 'index'
return
end
if test_request.output_file_name!=nil
data = File.open(test_request.output_file_name).read(2048)
jittat
fix bug: test_request: read empty output file...
r49 if data==nil
data=""
end
jittat
moved test interface functionality to test_controller...
r44 send_data(data,
{:filename => 'output.txt',
:type => 'text/plain'})
return
end
redirect_to :action => 'index'
end
jittat
[web] add test result page...
r79
def result
@user = User.find(session[:user_id])
begin
@test_request = TestRequest.find(params[:id])
rescue
@test_request = nil
end
if @test_request==nil or @test_request.user_id != @user.id
flash[:notice] = 'Invalid request'
redirect_to :action => 'index'
return
end
end
jittat
moved test interface functionality to test_controller...
r44
protected
def prepare_index_information
jittat
[web] fixed test_request error when user does not put in any file...
r86 @user = User.find(session[:user_id])
jittat
moved test interface functionality to test_controller...
r44 @submissions = Submission.find_last_for_all_available_problems(@user.id)
jittat
[web] added test_allowed flag to problems...
r94 all_problems = @submissions.collect { |submission| submission.problem }
@problems = []
all_problems.each do |problem|
if problem.test_allowed
@problems << problem
end
end
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162 @test_requests = []
@user.test_requests.each do |ts|
jittat
import problem replaced old one, fixed small problems...
r205 if ts.problem and ts.problem.available
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162 @test_requests << ts
end
end
jittat
moved test interface functionality to test_controller...
r44 end
jittat
[web] added mode + access control, when sites started/finished...
r122 def check_viewability
user = User.find(session[:user_id])
Jittat Fakcharoenphol
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
r320 if !GraderConfiguration.show_tasks_to?(user)
jittat
[web] added mode + access control, when sites started/finished...
r122 redirect_to :controller => 'main', :action => 'list'
end
Jittat Fakcharoenphol
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
r320 if (!GraderConfiguration.show_submitbox_to?(user)) and (action_name=='submit')
jittat
[web] added mode + access control, when sites started/finished...
r122 redirect_to :controller => 'test', :action => 'index'
end
end
jittat
moved test interface functionality to test_controller...
r44 end