Rename user to contributor in submission

This commit is contained in:
kiragrammel
2023-08-11 12:15:36 +02:00
committed by Sebastian Serth
parent 97138288f4
commit 0234414bae
39 changed files with 267 additions and 233 deletions

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
class RenameUserColumnsToContributorInSubmissions < ActiveRecord::Migration[7.0]
def change
change_table :submissions do |t|
t.rename :user_id, :contributor_id
t.rename :user_type, :contributor_type
end
end
end

View File

@ -454,15 +454,15 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_27_080619) do
create_table "submissions", id: :serial, force: :cascade do |t|
t.integer "exercise_id"
t.float "score"
t.integer "user_id"
t.integer "contributor_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cause"
t.string "user_type"
t.string "contributor_type"
t.bigint "study_group_id"
t.index ["contributor_id"], name: "index_submissions_on_contributor_id"
t.index ["exercise_id"], name: "index_submissions_on_exercise_id"
t.index ["study_group_id"], name: "index_submissions_on_study_group_id"
t.index ["user_id"], name: "index_submissions_on_user_id"
end
create_table "subscriptions", id: :serial, force: :cascade do |t|

View File

@ -28,7 +28,7 @@ ExecutionEnvironment.create_factories user: admin
@exercises = find_factories_by_class(Exercise).map(&:name).index_with {|factory_name| FactoryBot.create(factory_name, user: teacher) }
# submissions
FactoryBot.create(:submission, exercise: @exercises[:fibonacci], user: external_user)
FactoryBot.create(:submission, exercise: @exercises[:fibonacci], contributor: external_user)
# The old images included in the seed data do not feature a dedicated `user` and therefore require a privileged execution.
ExecutionEnvironment.update_all privileged_execution: true # rubocop:disable Rails/SkipsModelValidations