Description:
rename submission_view_log class don't log when admin is viewing
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r530:d41578f393ed - - 2 files changed: 3 inserted, 2 deleted

@@ -65,49 +65,50
65 65
66 66 def test_request
67 67 @test_request = TestRequest.find(params[:id])
68 68 end
69 69
70 70 def task
71 71 @task = Task.find(params[:id])
72 72 end
73 73
74 74 def submission
75 75 @submission = Submission.find(params[:id])
76 76 formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true )
77 77 lexer = case @submission.language.name
78 78 when "c" then Rouge::Lexers::C.new
79 79 when "cpp" then Rouge::Lexers::Cpp.new
80 80 when "pas" then Rouge::Lexers::Pas.new
81 81 when "ruby" then Rouge::Lexers::Ruby.new
82 82 when "python" then Rouge::Lexers::Python.new
83 83 when "java" then Rouge::Lexers::Java.new
84 84 when "php" then Rouge::Lexers::PHP.new
85 85 end
86 86 @formatted_code = formatter.format(lexer.lex(@submission.source))
87 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 92 end
92 93
93 94 # various grader controls
94 95
95 96 def stop
96 97 grader_proc = GraderProcess.find(params[:id])
97 98 GraderScript.stop_grader(grader_proc.pid)
98 99 flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.'
99 100 redirect_to :action => 'list'
100 101 end
101 102
102 103 def stop_all
103 104 GraderScript.stop_graders(GraderProcess.find_running_graders +
104 105 GraderProcess.find_stalled_process)
105 106 flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.'
106 107 redirect_to :action => 'list'
107 108 end
108 109
109 110 def start_grading
110 111 GraderScript.start_grader('grading')
111 112 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
112 113 redirect_to :action => 'list'
113 114 end
@@ -1,3 +1,3
1 - class SubmissionViewLogs < ActiveRecord::Base
1 + class SubmissionViewLog < ActiveRecord::Base
2 2 attr_accessible :submission_id, :user_id
3 3 end
You need to be logged in to leave comments. Login now