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,3 +1,5 @@
# frozen_string_literal: true
class CreateExercises < ActiveRecord::Migration[4.2]
def change
create_table :exercises do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
create_table :execution_environments do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateSubmissions < ActiveRecord::Migration[4.2]
def change
create_table :submissions do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddReferenceImplementationToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :reference_implementation, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddIndentSizeToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :indent_size, :integer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateConsumers < ActiveRecord::Migration[4.2]
def change
create_table :consumers do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddOauthKeyToConsumers < ActiveRecord::Migration[4.2]
def change
add_column :consumers, :oauth_key, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddOauthSecretToConsumers < ActiveRecord::Migration[4.2]
def change
add_column :consumers, :oauth_secret, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddRoleToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :role, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserIdToExercises < ActiveRecord::Migration[4.2]
def change
add_reference :exercises, :user

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddRunCommandToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :run_command, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTestCommandToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :test_command, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTestCodeToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :test_code, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddCauseToSubmissions < ActiveRecord::Migration[4.2]
def change
add_column :submissions, :cause, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTemplateTestCodeToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :template_test_code, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSupportsUserDefinedTestsToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :supports_user_defined_tests, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTestingFrameworkToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :testing_framework, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateFileTypes < ActiveRecord::Migration[4.2]
def change
create_table :file_types do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateFiles < ActiveRecord::Migration[4.2]
def change
create_table :files do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveFileTypeRelatedColumnsFromExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
remove_column :execution_environments, :editor_mode, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveFileRelatedColumnsFromExercises < ActiveRecord::Migration[4.2]
def change
remove_column :exercises, :reference_implementation, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveCodeFromSubmissions < ActiveRecord::Migration[4.2]
def change
remove_column :submissions, :code, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddInstructionsToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :instructions, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddPublishedToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :published, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddExecutableToFileTypes < ActiveRecord::Migration[4.2]
def change
add_column :file_types, :executable, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddRenderableToFileTypes < ActiveRecord::Migration[4.2]
def change
add_column :file_types, :renderable, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateExternalUsers < ActiveRecord::Migration[4.2]
def change
create_table :external_users do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateInternalUsers < ActiveRecord::Migration[4.2]
def change
create_table :internal_users do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DropUsers < ActiveRecord::Migration[4.2]
def change
drop_table :users

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserTypeToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :user_type, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserTypeToFileTypes < ActiveRecord::Migration[4.2]
def change
add_column :file_types, :user_type, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserTypeToSubmissions < ActiveRecord::Migration[4.2]
def change
add_column :submissions, :user_type, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SorceryCore < ActiveRecord::Migration[4.2]
def change
InternalUser.delete_all

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SorceryBruteForceProtection < ActiveRecord::Migration[4.2]
def change
add_column :internal_users, :failed_logins_count, :integer, default: 0

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SorceryRememberMe < ActiveRecord::Migration[4.2]
def change
add_column :internal_users, :remember_me_token, :string, default: nil

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SorceryResetPassword < ActiveRecord::Migration[4.2]
def change
add_column :internal_users, :reset_password_token, :string, default: nil

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SorceryUserActivation < ActiveRecord::Migration[4.2]
def change
add_column :internal_users, :activation_state, :string, default: nil

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddBinaryToFileTypes < ActiveRecord::Migration[4.2]
def change
add_column :file_types, :binary, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddNativeFileToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :native_file, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateHints < ActiveRecord::Migration[4.2]
def change
create_table :hints do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveNotNullConstraintsFromInternalUsers < ActiveRecord::Migration[4.2]
def change
change_column_null(:internal_users, :crypted_password, true)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateErrors < ActiveRecord::Migration[4.2]
def change
create_table :errors do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTokenToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :token, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFileIdToExercises < ActiveRecord::Migration[4.2]
def change
add_reference :exercises, :file

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddRoleToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :role, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveFileIdFromExercises < ActiveRecord::Migration[4.2]
def change
remove_reference :exercises, :file

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddHashedContentToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :hashed_content, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFeedbackMessageToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :feedback_message, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddWeightToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :weight, :float

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddHelpToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :help, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddExposedPortsToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :exposed_ports, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddPermittedExecutionTimeToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :permitted_execution_time, :integer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserIdAndUserTypeToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_reference :execution_environments, :user

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RenamePublishedToPublic < ActiveRecord::Migration[4.2]
def change
rename_column :exercises, :published, :public

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddPathToFiles < ActiveRecord::Migration[4.2]
def change
add_column :files, :path, :string

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateComments < ActiveRecord::Migration[4.2]
def change
create_table :comments do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateTeams < ActiveRecord::Migration[4.2]
def change
create_table :teams do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateInternalUsersTeams < ActiveRecord::Migration[4.2]
def change
create_table :internal_users_teams do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddTeamIdToExercises < ActiveRecord::Migration[4.2]
def change
add_reference :exercises, :team

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddPoolSizeToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :pool_size, :integer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFileTypeIdToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_reference :execution_environments, :file_type

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddMemoryLimitToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :memory_limit, :integer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddNetworkEnabledToExecutionEnvironments < ActiveRecord::Migration[4.2]
def change
add_column :execution_environments, :network_enabled, :boolean

View File

@ -1,9 +1,11 @@
# frozen_string_literal: true
class CreateRequestForComments < ActiveRecord::Migration[4.2]
def change
create_table :request_for_comments do |t|
t.integer :requestorid, :null => false
t.integer :exerciseid, :null => false
t.integer :fileid, :null => false
t.integer :requestorid, null: false
t.integer :exerciseid, null: false
t.integer :fileid, null: false
t.timestamp :requested_at
t.timestamps

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSubmissionToError < ActiveRecord::Migration[4.2]
def change
add_reference :errors, :submission, index: true

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
class AddFileIndexToFiles < ActiveRecord::Migration[4.2]
def change
add_index(:files, [:context_id, :context_type])
add_index(:files, %i[context_id context_type])
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserTypeToRequestForComments < ActiveRecord::Migration[4.2]
def change
add_column :request_for_comments, :user_type, :string

View File

@ -1,7 +1,9 @@
# frozen_string_literal: true
class CorrectColumnNames < ActiveRecord::Migration[4.2]
def change
rename_column :request_for_comments, :requestorid, :requestor_user_id
rename_column :request_for_comments, :exerciseid, :exercise_id
rename_column :request_for_comments, :fileid, :file_id
rename_column :request_for_comments, :requestorid, :requestor_user_id
rename_column :request_for_comments, :exerciseid, :exercise_id
rename_column :request_for_comments, :fileid, :file_id
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveRequestorFromRequestForComments < ActiveRecord::Migration[4.2]
def change
rename_column :request_for_comments, :requestor_user_id, :user_id

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddHideFileTreeToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :hide_file_tree, :boolean

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateCodeHarborLinks < ActiveRecord::Migration[4.2]
def change
create_table :code_harbor_links do |t|

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
class AddUserToCodeHarborLink < ActiveRecord::Migration[4.2]
def change
add_reference :code_harbor_links, :user, polymorphic: true, index: true
add_reference :code_harbor_links, :user, polymorphic: true, index: true
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateTestruns < ActiveRecord::Migration[4.2]
def change
create_table :testruns do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddQuestionToRequestForComments < ActiveRecord::Migration[4.2]
def change
add_column :request_for_comments, :question, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddAllowFileCreationToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :allow_file_creation, :boolean

View File

@ -1,7 +1,10 @@
# frozen_string_literal: true
class ChangeCommentTextAttributeToTextDatatype < ActiveRecord::Migration[4.2]
def up
change_column :comments, :text, :text
end
def down
# This might cause trouble if you have strings longer
# than 255 characters.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateFileTemplates < ActiveRecord::Migration[4.2]
def change
create_table :file_templates do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFileTemplateToFile < ActiveRecord::Migration[4.2]
def change
add_reference :files, :file_template

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSolvedToRequestForComments < ActiveRecord::Migration[4.2]
def change
add_column :request_for_comments, :solved, :boolean

View File

@ -1,33 +1,33 @@
# frozen_string_literal: true
class AddSubmissionToRequestForComments < ActiveRecord::Migration[4.2]
def change
add_reference :request_for_comments, :submission
end
end
=begin
We issued the following on the database to add the submission_ids for existing entries
UPDATE request_for_comments
SET submission_id = sub.submission_id_external
FROM
(SELECT s.id AS submission_id_external,
rfc.id AS rfc_id,
s.created_at AS submission_created_at,
rfc.created_at AS rfc_created_at
FROM submissions s,
request_for_comments rfc
WHERE s.user_id = rfc.user_id
AND s.exercise_id = rfc.exercise_id
AND rfc.created_at + interval '2 hours' > s.created_at
AND s.created_at =
(SELECT MAX(created_at)
FROM submissions
WHERE exercise_id = s.exercise_id
AND user_id = s.user_id
AND rfc.created_at + interval '2 hours' > created_at
GROUP BY s.exercise_id,
s.user_id)) as sub
WHERE id = sub.rfc_id
AND submission_id IS NULL;
=end
# We issued the following on the database to add the submission_ids for existing entries
#
# UPDATE request_for_comments
# SET submission_id = sub.submission_id_external
# FROM
# (SELECT s.id AS submission_id_external,
# rfc.id AS rfc_id,
# s.created_at AS submission_created_at,
# rfc.created_at AS rfc_created_at
# FROM submissions s,
# request_for_comments rfc
# WHERE s.user_id = rfc.user_id
# AND s.exercise_id = rfc.exercise_id
# AND rfc.created_at + interval '2 hours' > s.created_at
# AND s.created_at =
# (SELECT MAX(created_at)
# FROM submissions
# WHERE exercise_id = s.exercise_id
# AND user_id = s.user_id
# AND rfc.created_at + interval '2 hours' > created_at
# GROUP BY s.exercise_id,
# s.user_id)) as sub
# WHERE id = sub.rfc_id
# AND submission_id IS NULL;
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveRequestedAtFromRequestForComments < ActiveRecord::Migration[4.2]
def change
remove_column :request_for_comments, :requested_at

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RemoveTeams < ActiveRecord::Migration[4.2]
def change
remove_reference :exercises, :team

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddAllowAutoCompletionToExercises < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :allow_auto_completion, :boolean, default: false

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateLtiParameters < ActiveRecord::Migration[4.2]
def change
create_table :lti_parameters do |t|
@ -8,4 +10,4 @@ class CreateLtiParameters < ActiveRecord::Migration[4.2]
t.timestamps
end
end
end
end

View File

@ -1,11 +1,13 @@
# frozen_string_literal: true
class CreateRemoteEvaluationMappings < ActiveRecord::Migration[4.2]
def change
create_table :remote_evaluation_mappings do |t|
t.integer "user_id", null: false
t.integer "exercise_id", null: false
t.string "validation_token", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer 'user_id', null: false
t.integer 'exercise_id', null: false
t.string 'validation_token', null: false
t.datetime 'created_at'
t.datetime 'updated_at'
end
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateExerciseCollections < ActiveRecord::Migration[4.2]
def change
create_table :exercise_collections do |t|
@ -9,6 +11,5 @@ class CreateExerciseCollections < ActiveRecord::Migration[4.2]
t.belongs_to :exercise_collection, index: true
t.belongs_to :exercise, index: true
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateProxyExercises < ActiveRecord::Migration[4.2]
def change
create_table :proxy_exercises do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateInterventions < ActiveRecord::Migration[4.2]
def change
create_table :user_exercise_interventions do |t|
@ -16,8 +18,5 @@ class CreateInterventions < ActiveRecord::Migration[4.2]
end
Intervention.createDefaultInterventions
end
end

View File

@ -1,5 +1,6 @@
class AddTags < ActiveRecord::Migration[4.2]
# frozen_string_literal: true
class AddTags < ActiveRecord::Migration[4.2]
def change
add_column :exercises, :expected_worktime_seconds, :integer, default: 60
add_column :exercises, :expected_difficulty, :integer, default: 1
@ -15,5 +16,4 @@ class AddTags < ActiveRecord::Migration[4.2]
t.integer :factor, default: 1
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddUserFeedback < ActiveRecord::Migration[4.2]
def change
create_table :user_exercise_feedbacks do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSearch < ActiveRecord::Migration[4.2]
def change
create_table :searches do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddReasonToUserProxyExerciseExercise < ActiveRecord::Migration[4.2]
def change
change_table :user_proxy_exercise_exercises do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddIndexToSubmissions < ActiveRecord::Migration[4.2]
def change
add_index :submissions, :exercise_id

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
class SetDefaultForRequestForCommentSolved < ActiveRecord::Migration[4.2]
def change
change_column_default :request_for_comments, :solved, false
RequestForComment.where(solved: nil).update_all(solved: false)
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ImproveUserFeedback < ActiveRecord::Migration[4.2]
def change
add_column :user_exercise_feedbacks, :user_estimated_worktime, :integer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddThankYouNoteToRequestForComments < ActiveRecord::Migration[4.2]
def change
add_column :request_for_comments, :thank_you_note, :text

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateErrorTemplates < ActiveRecord::Migration[4.2]
def change
create_table :error_templates do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateErrorTemplateAttributes < ActiveRecord::Migration[4.2]
def change
create_table :error_template_attributes do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateStructuredErrors < ActiveRecord::Migration[4.2]
def change
create_table :structured_errors do |t|

Some files were not shown because too many files have changed in this diff Show More