Apply automatic rubocop fixes

This commit is contained in:
Sebastian Serth
2021-05-14 10:51:44 +02:00
parent fe4000916c
commit 6cbecb5b39
440 changed files with 2705 additions and 1853 deletions

View File

@@ -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)