Skip to content

Commit

Permalink
Fix contributor renaming and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kiragrammel committed Jul 27, 2023
1 parent 6f93f7e commit 5940934
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/controllers/concerns/submission_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def merge_user(params)
# The study_group_id might not be present in the session (e.g. for internal users), resulting in session[:study_group_id] = nil which is intended.
params.merge(
contributor_id: current_user.id,
contributor_type: current_user.class.name,
study_group_id: current_user.current_study_group_id
)
end
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/exercises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ def implement
@paths = collect_paths(@files)

@contributor_id = if current_user.respond_to? :external_id
current_user.external_id
else
current_user.id
end
current_user.external_id
else
current_user.id
end
end

def set_course_token
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/flowr_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def insights
require_user!
# get the latest submission for this user that also has a test run (i.e. structured_errors if applicable)
submission = Submission.joins(:testruns)
.where(submissions: {user: current_user})
.where(submissions: {contributor: current_user})
.includes(structured_errors: [structured_error_attributes: [:error_template_attribute]])
.merge(Testrun.order(created_at: :desc)).first

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def change
t.rename :user_type, :contributor_type
end
end
end
end
2 changes: 1 addition & 1 deletion db/migrate/20230710131250_create_programming_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateProgrammingGroups < ActiveRecord::Migration[7.0]
def change
create_table :programming_groups do |t|
create_table :programming_groups, id: :uuid do |t|
t.belongs_to :exercise

t.timestamps
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
t.index ["user_type", "user_id"], name: "index_programming_group_memberships_on_user"
end

create_table "programming_groups", force: :cascade do |t|
create_table "programming_groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "exercise_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down

0 comments on commit 5940934

Please sign in to comment.