Apply automatic rubocop fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class DropErrors < ActiveRecord::Migration[5.2]
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropErrors < ActiveRecord::Migration[5.2]
|
||||
# define old CodeOcean::Error module so that the migration works
|
||||
module CodeOcean
|
||||
class Error < ApplicationRecord
|
||||
@@ -15,21 +16,16 @@ class DropErrors < ActiveRecord::Migration[5.2]
|
||||
true
|
||||
end
|
||||
|
||||
def to_s
|
||||
id.to_s
|
||||
end
|
||||
delegate :to_s, to: :id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def change
|
||||
|
||||
puts 'Migrating CodeOcean::Errors to StructuredErrors using RegEx. This might take a (long) while but will return.'
|
||||
submissions_controller = SubmissionsController.new
|
||||
|
||||
# Iterate only over those Errors containing a message and submission_id
|
||||
CodeOcean::Error.where.not(message: [nil, ""]).where.not(submission_id: [nil, ""]).each do |error|
|
||||
CodeOcean::Error.where.not(message: [nil, '']).where.not(submission_id: [nil, '']).each do |error|
|
||||
raw_output = error.message
|
||||
submission = Submission.find_by(id: error.submission_id)
|
||||
|
||||
|
Reference in New Issue
Block a user