Completely remove old non-structured errors and migrate existing ones.

This commit is contained in:
Sebastian Serth
2018-11-29 19:38:23 +01:00
parent efacb5a6a9
commit 56c59a616e
19 changed files with 48 additions and 216 deletions

View File

@ -1,40 +0,0 @@
module CodeOcean
class ErrorsController < ApplicationController
before_action :set_execution_environment
def authorize!
authorize(@error || @errors)
end
private :authorize!
def create
@error = CodeOcean::Error.new(error_params)
authorize!
respond_to do |format|
format.json do
head (@error.save ? :created : :unprocessable_entity)
end
end
end
def error_params
params[:error].permit(:message, :submission_id).merge(execution_environment_id: @execution_environment.id) if params[:error].present?
end
private :error_params
def index
@errors = CodeOcean::Error.for_execution_environment(@execution_environment).grouped_by_message.paginate(page: params[:page])
authorize!
end
def set_execution_environment
@execution_environment = ExecutionEnvironment.find(params[:execution_environment_id])
end
private :set_execution_environment
def show
@error = CodeOcean::Error.find(params[:id])
authorize!
end
end
end

View File

@ -126,10 +126,6 @@ class SubmissionsController < ApplicationController
# server_sent_event.write({stdout: output[:stdout]}, event: 'output') if output[:stdout]
# server_sent_event.write({stderr: output[:stderr]}, event: 'output') if output[:stderr]
# unless output[:stderr].nil?
# store_error(output[:stderr])
# end
# end
hijack do |tubesock|
@ -361,11 +357,6 @@ class SubmissionsController < ApplicationController
head :ok
end
def store_error(stderr)
CodeOcean::Error.create(submission_id: @submission.id, execution_environment_id: @submission.execution_environment.id, message: stderr)
end
private :store_error
def test
hijack do |tubesock|
Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?