Show More
Commit Description:
add submissions to users
Commit Description:
add submissions to users
References:
File last commit:
Show/Diff file:
Action:
app/controllers/graders_controller.rb
| 93 lines
| 2.5 KiB
| text/x-ruby
| RubyLexer
|
|
|
r29 | class GradersController < ApplicationController | ||
|
|
r32 | |||
| r680 | before_filter :admin_authorization | |||
|
|
r105 | |||
|
|
r203 | verify :method => :post, :only => ['clear_all', | ||
| 'start_exam', | ||||
| 'start_grading', | ||||
| 'stop_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 | |||
| r619 | @last_task = Task.last | |||
| @last_test_request = TestRequest.last | ||||
| r461 | @submission = Submission.order("id desc").limit(20) | |||
| r588 | @backlog_submission = Submission.where('graded_at is null') | |||
|
|
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 | ||
| r619 | GraderProcess.all.each do |p| | |||
|
|
r105 | 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 | ||||
|
|
r202 | # various grader controls | ||
| def stop | ||||
| grader_proc = GraderProcess.find(params[:id]) | ||||
|
|
r203 | GraderScript.stop_grader(grader_proc.pid) | ||
| flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' | ||||
| redirect_to :action => 'list' | ||||
| end | ||||
| def stop_all | ||||
| GraderScript.stop_graders(GraderProcess.find_running_graders + | ||||
| GraderProcess.find_stalled_process) | ||||
| flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' | ||||
|
|
r202 | redirect_to :action => 'list' | ||
| end | ||||
|
|
r203 | def start_grading | ||
| GraderScript.start_grader('grading') | ||||
| flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' | ||||
| redirect_to :action => 'list' | ||||
| end | ||||
|
|
r202 | |||
|
|
r203 | def start_exam | ||
| GraderScript.start_grader('exam') | ||||
| flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' | ||||
| redirect_to :action => 'list' | ||||
|
|
r202 | end | ||
|
|
r29 | end | ||
