Description:
rename submission_view_log class
don't log when admin is viewing
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r530:d41578f393ed - - 2 files changed: 3 inserted, 2 deleted
@@ -65,49 +65,50 | |||||
|
65 |
|
65 | ||
|
66 | def test_request |
|
66 | def test_request |
|
67 | @test_request = TestRequest.find(params[:id]) |
|
67 | @test_request = TestRequest.find(params[:id]) |
|
68 | end |
|
68 | end |
|
69 |
|
69 | ||
|
70 | def task |
|
70 | def task |
|
71 | @task = Task.find(params[:id]) |
|
71 | @task = Task.find(params[:id]) |
|
72 | end |
|
72 | end |
|
73 |
|
73 | ||
|
74 | def submission |
|
74 | def submission |
|
75 | @submission = Submission.find(params[:id]) |
|
75 | @submission = Submission.find(params[:id]) |
|
76 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
76 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
77 | lexer = case @submission.language.name |
|
77 | lexer = case @submission.language.name |
|
78 | when "c" then Rouge::Lexers::C.new |
|
78 | when "c" then Rouge::Lexers::C.new |
|
79 | when "cpp" then Rouge::Lexers::Cpp.new |
|
79 | when "cpp" then Rouge::Lexers::Cpp.new |
|
80 | when "pas" then Rouge::Lexers::Pas.new |
|
80 | when "pas" then Rouge::Lexers::Pas.new |
|
81 | when "ruby" then Rouge::Lexers::Ruby.new |
|
81 | when "ruby" then Rouge::Lexers::Ruby.new |
|
82 | when "python" then Rouge::Lexers::Python.new |
|
82 | when "python" then Rouge::Lexers::Python.new |
|
83 | when "java" then Rouge::Lexers::Java.new |
|
83 | when "java" then Rouge::Lexers::Java.new |
|
84 | when "php" then Rouge::Lexers::PHP.new |
|
84 | when "php" then Rouge::Lexers::PHP.new |
|
85 | end |
|
85 | end |
|
86 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
86 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
87 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
87 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
88 |
|
88 | ||
|
89 | - SubmissionViewLogs.create(user_id: session[:user_id],submission_id: @submission.id) |
|
89 | + user = User.find(session[:user_id]) |
|
|
90 | + SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? | ||
|
90 |
|
91 | ||
|
91 | end |
|
92 | end |
|
92 |
|
93 | ||
|
93 | # various grader controls |
|
94 | # various grader controls |
|
94 |
|
95 | ||
|
95 | def stop |
|
96 | def stop |
|
96 | grader_proc = GraderProcess.find(params[:id]) |
|
97 | grader_proc = GraderProcess.find(params[:id]) |
|
97 | GraderScript.stop_grader(grader_proc.pid) |
|
98 | GraderScript.stop_grader(grader_proc.pid) |
|
98 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
99 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
99 | redirect_to :action => 'list' |
|
100 | redirect_to :action => 'list' |
|
100 | end |
|
101 | end |
|
101 |
|
102 | ||
|
102 | def stop_all |
|
103 | def stop_all |
|
103 | GraderScript.stop_graders(GraderProcess.find_running_graders + |
|
104 | GraderScript.stop_graders(GraderProcess.find_running_graders + |
|
104 | GraderProcess.find_stalled_process) |
|
105 | GraderProcess.find_stalled_process) |
|
105 | flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' |
|
106 | flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' |
|
106 | redirect_to :action => 'list' |
|
107 | redirect_to :action => 'list' |
|
107 | end |
|
108 | end |
|
108 |
|
109 | ||
|
109 | def start_grading |
|
110 | def start_grading |
|
110 | GraderScript.start_grader('grading') |
|
111 | GraderScript.start_grader('grading') |
|
111 | flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' |
|
112 | flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' |
|
112 | redirect_to :action => 'list' |
|
113 | redirect_to :action => 'list' |
|
113 | end |
|
114 | end |
You need to be logged in to leave comments.
Login now