Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,34 @@ class ProfilesController < ApplicationController
before_action :check_profile_found!, :check_published!, only: :show

def index
@profiles = @competition.profiles.published
.where("#{User.table_name}.deactivated_at is null")
.where.not(identifier: [nil, ''])
# Original filter
# @profiles = @competition.profiles.published
# .where.not(identifier: [nil, ''])
# .preload(:user)
# .includes(:skills)
#
# Changed to only display profiles for users that have registered
# for a Competition Event Type for the given @competition (i.e. Current Competition)
@profiles = Profile
.joins(
user: {
assignments: {
registrations: %i[event competition],
},
},
)
.where.not(
identifier: [nil, ''],
)
.where(
events: {
event_type: 'Competition',
},
competitions: {
id: @competition.id,
},
)
.published
.preload(:user)
.includes(:skills)
end
Expand Down
1 change: 0 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# data_cruncher :boolean default(FALSE)
# deactivated_at :datetime
# dietary_requirements :text
# email :string default(""), not null
# encrypted_password :string default(""), not null
Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20250903110000_remove_user_deactivated_at.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class RemoveUserDeactivatedAt < ActiveRecord::Migration[7.0]
def up
remove_column :users, :deactivated_at
end
def down
add_column :users, :deactivated_at, :datetime
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2025_08_22_200000) do
ActiveRecord::Schema[7.0].define(version: 2025_09_03_110000) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -523,7 +523,6 @@
t.boolean "under_18"
t.integer "region"
t.integer "acting_on_behalf_of_id"
t.datetime "deactivated_at"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["region"], name: "index_users_on_region"
Expand Down
1 change: 0 additions & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# data_cruncher :boolean default(FALSE)
# deactivated_at :datetime
# dietary_requirements :text
# email :string default(""), not null
# encrypted_password :string default(""), not null
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# data_cruncher :boolean default(FALSE)
# deactivated_at :datetime
# dietary_requirements :text
# email :string default(""), not null
# encrypted_password :string default(""), not null
Expand Down
1 change: 0 additions & 1 deletion test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# data_cruncher :boolean default(FALSE)
# deactivated_at :datetime
# dietary_requirements :text
# email :string default(""), not null
# encrypted_password :string default(""), not null
Expand Down
Loading