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

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/jobseekers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ class Jobseekers::ProfilesController < Jobseekers::BaseController
link_text: "Add training",
page_path: -> { new_jobseekers_profile_training_and_cpd_path },
},
{
title: "Professional Body Memberships",
display_summary: ->(profile) { profile.professional_body_memberships.present? },
key: "professional_body_memberships",
link_text: "Add membership",
page_path: -> { new_jobseekers_profile_professional_body_membership_path },
},
{
title: "Work history",
display_summary: ->(profile) { profile.employments.any? },
Expand Down
1 change: 0 additions & 1 deletion app/models/jobseeker_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class JobseekerProfile < ApplicationRecord
has_many :training_and_cpds, dependent: :destroy
has_many :organisation_exclusions, class_name: "JobseekerProfileExcludedOrganisation", dependent: :destroy
has_many :excluded_organisations, through: :organisation_exclusions, source: :organisation
has_many :professional_body_memberships, dependent: :destroy

delegate :first_name, :last_name, to: :personal_details, allow_nil: true
delegate :email, to: :jobseeker
Expand Down
10 changes: 9 additions & 1 deletion app/models/professional_body_membership.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
class ProfessionalBodyMembership < ApplicationRecord
include ApplicationAndProfileAssociatedRecord
belongs_to :job_application

def duplicate
# dup does a shallow copy, but although it "doesn't copy associations" according to the
# docs, it *does* copy parent associations so we remove these
dup.tap do |record|
record.assign_attributes(job_application: nil)
end
end
end
29 changes: 0 additions & 29 deletions app/views/jobseekers/profiles/_summary.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,3 @@ dl.govuk-summary-list
= training.grade
p.govuk-hint = "#{training.provider}, #{training.year_awarded}"
hr.govuk-section-break.govuk-section-break--s.govuk-section-break--visible

- if profile.professional_body_memberships.any?
h2.govuk-heading-m class="govuk-!-padding-bottom-3" = t(".professional_body_memberships")
- profile.professional_body_memberships.each do |professional_body_membership|
= govuk_summary_list classes: "govuk-!-margin-bottom-0" do |summary_list|
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_professional_body_membership_form.name")
- row.with_value text: professional_body_membership.name

- if professional_body_membership.membership_type.present?
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_professional_body_membership_form.membership_type")
- row.with_value text: professional_body_membership.membership_type

- if professional_body_membership.membership_number.present?
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_professional_body_membership_form.membership_number")
- row.with_value text: professional_body_membership.membership_number

- if professional_body_membership.year_membership_obtained.present?
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_professional_body_membership_form.year_membership_obtained")
- row.with_value text: professional_body_membership.year_membership_obtained

- if professional_body_membership.exam_taken.present?
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_professional_body_membership_form.exam_taken")
- row.with_value text: t("helpers.label.jobseekers_professional_body_membership_form.exam_taken_options.#{professional_body_membership.exam_taken}")
br

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ shared:
- membership_number
- year_membership_obtained
- exam_taken
- jobseeker_profile_id
- job_application_id
:self_disclosure_requests:
- id
Expand Down
5 changes: 0 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@
get :review, on: :collection, to: "profiles/training_and_cpds#review"
get :confirm_destroy
end
resources :professional_body_memberships, only: %i[new create edit update destroy], controller: "profiles/professional_body_memberships" do
get :review, on: :collection, to: "profiles/professional_body_memberships#review"
get :confirm_destroy
end

resources :breaks, only: %i[new create edit update destroy], controller: "profiles/breaks" do
get :confirm_destroy
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class ProfessionalMembershipJobApplication < ActiveRecord::Migration[8.0]
disable_ddl_transaction!

def change
# This needs doing at the same time as this existing change, so I can't work out how
# we could do this as a seperate task...
ProfessionalBodyMembership.where(job_application_id: nil).find_in_batches do |pbm_batch|
ProfessionalBodyMembership.transaction do
pbm_batch.each(&:destroy!)
end
end
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: Couldn't we leave the schema migration for a second PR?

  1. This PR:
  • Interface & Flow changes.
  • Jobseekers can no longer add or see listed Professional Body Memberships.
  • Rake task with above code, removing any existing Professional Body Membership belonging to Jobseeker Profiles.
  1. Second PR:
  • Schema migration
  • Removal of model association
  • Analytics, etc.


remove_index :professional_body_memberships, :jobseeker_profile_id, algorithm: :concurrently
safety_assured { remove_column :professional_body_memberships, :jobseeker_profile_id, :uuid }

add_not_null_constraint :professional_body_memberships, :job_application_id, name: "professional_body_memberships_job_application_id_null", validate: false
# You can use `validate_constraint_in_background` if you have a very large table
# and want to validate the constraint using background schema migrations.
validate_not_null_constraint :professional_body_memberships, :job_application_id, name: "professional_body_memberships_job_application_id_null"

change_column_null :professional_body_memberships, :job_application_id, false
remove_check_constraint :professional_body_memberships, name: "professional_body_memberships_job_application_id_null"
end
end
7 changes: 2 additions & 5 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[8.0].define(version: 2026_03_30_082849) do
ActiveRecord::Schema[8.0].define(version: 2026_03_30_105614) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gist"
enable_extension "citext"
Expand Down Expand Up @@ -618,10 +618,8 @@
t.string "membership_number"
t.integer "year_membership_obtained"
t.boolean "exam_taken", default: false, null: false
t.uuid "jobseeker_profile_id"
t.uuid "job_application_id"
t.uuid "job_application_id", null: false
t.index ["job_application_id"], name: "index_professional_body_memberships_on_job_application_id"
t.index ["jobseeker_profile_id"], name: "index_professional_body_memberships_on_jobseeker_profile_id"
end

create_table "publisher_ats_api_clients", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
Expand Down Expand Up @@ -1027,7 +1025,6 @@
add_foreign_key "personal_details", "jobseeker_profiles"
add_foreign_key "pre_employment_check_sets", "job_applications"
add_foreign_key "professional_body_memberships", "job_applications"
add_foreign_key "professional_body_memberships", "jobseeker_profiles"
add_foreign_key "publisher_preferences", "organisations"
add_foreign_key "publisher_preferences", "publishers"
add_foreign_key "qualification_results", "qualifications"
Expand Down
1 change: 0 additions & 1 deletion spec/factories/jobseeker_profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
qualifications { build_list(:qualification, 1, :with_random_category, job_application: nil, jobseeker_profile: instance) }
employments { build_list(:employment, 1, :current_role, job_application: nil, jobseeker_profile: instance) }
training_and_cpds { build_list(:training_and_cpd, 1, job_application: nil, jobseeker_profile: instance) }
professional_body_memberships { build_list(:professional_body_membership, 1, job_application: nil, jobseeker_profile: instance) }
end
end
end
1 change: 0 additions & 1 deletion spec/factories/professional_body_memberships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
year_membership_obtained { "2020" }
exam_taken { true }

jobseeker_profile { nil }
job_application { nil }
end
end
Loading
Loading