Show More
Commit Description:
removed haml dir...
Commit Description:
removed haml dir
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@422 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/controllers/graders_controller.rb
| 64 lines
| 1.4 KiB
| text/x-ruby
| RubyLexer
|
|
r29 | class GradersController < ApplicationController | ||
|
r32 | |||
|
r105 | before_filter :admin_authorization | ||
|
r175 | verify :method => :post, :only => ['clear_all', 'clear_terminated'], | ||
|
r105 | :redirect_to => {:action => 'index'} | ||
def index | ||||
redirect_to :action => 'list' | ||||
end | ||||
|
r32 | |||
def list | ||||
|
r175 | @grader_processes = GraderProcess.find_running_graders | ||
|
r32 | @stalled_processes = GraderProcess.find_stalled_process | ||
|
r175 | |||
@terminated_processes = GraderProcess.find_terminated_graders | ||||
|
r127 | |||
@last_task = Task.find(:first, | ||||
:order => 'created_at DESC') | ||||
@last_test_request = TestRequest.find(:first, | ||||
:order => 'created_at DESC') | ||||
|
r32 | end | ||
def clear | ||||
grader_proc = GraderProcess.find(params[:id]) | ||||
grader_proc.destroy if grader_proc!=nil | ||||
redirect_to :action => 'list' | ||||
end | ||||
|
r175 | def clear_terminated | ||
GraderProcess.find_terminated_graders.each do |p| | ||||
p.destroy | ||||
end | ||||
redirect_to :action => 'list' | ||||
end | ||||
|
r105 | def clear_all | ||
GraderProcess.find(:all).each do |p| | ||||
p.destroy | ||||
end | ||||
redirect_to :action => 'list' | ||||
end | ||||
def view | ||||
if params[:type]=='Task' | ||||
redirect_to :action => 'task', :id => params[:id] | ||||
else | ||||
redirect_to :action => 'test_request', :id => params[:id] | ||||
end | ||||
end | ||||
def test_request | ||||
@test_request = TestRequest.find(params[:id]) | ||||
end | ||||
def task | ||||
@task = Task.find(params[:id]) | ||||
end | ||||
def submission | ||||
@submission = Submission.find(params[:id]) | ||||
end | ||||
|
r29 | end | ||