From f67f3716bd8901da22013586771b230fce2c8a77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 00:57:44 +0000 Subject: [PATCH 1/2] Initial plan From b7e33556b1c787fee9eafea54e39c8534e8aafed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 01:05:10 +0000 Subject: [PATCH 2/2] Convert position data to title data and remove position column Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- app/controllers/facilitators_controller.rb | 1 - app/controllers/users_controller.rb | 2 +- app/models/project.rb | 2 +- app/models/project_user.rb | 3 -- app/models/user.rb | 4 +- .../_project_user_fields.html.erb | 4 +- .../projects/_project_user_fields.html.erb | 4 +- app/views/shared/_project_user.html.erb | 2 +- app/views/users/_project_user_fields.html.erb | 2 +- ..._convert_project_user_position_to_title.rb | 42 +++++++++++++++++++ spec/factories/project_users.rb | 2 +- spec/models/project_user_spec.rb | 4 -- spec/views/users/show.html.erb_spec.rb | 2 +- 13 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20260120010312_convert_project_user_position_to_title.rb diff --git a/app/controllers/facilitators_controller.rb b/app/controllers/facilitators_controller.rb index ad1a27044..59ade76db 100644 --- a/app/controllers/facilitators_controller.rb +++ b/app/controllers/facilitators_controller.rb @@ -179,7 +179,6 @@ def facilitator_params project_users_attributes: [ :id, :project_id, - :position, :title, :inactive, :_destroy diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 78102f9c9..f4878368e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -135,7 +135,7 @@ def user_params :notes, :primary_address, :avatar, :subscribecode, :agency_id, :facilitator_id, :created_by_id, :updated_by_id, :confirmed, :inactive, :super_user, :legacy, :legacy_id, - project_users_attributes: [ :id, :project_id, :position, :title, :inactive, :_destroy ] + project_users_attributes: [ :id, :project_id, :title, :inactive, :_destroy ] ) end end diff --git a/app/models/project.rb b/app/models/project.rb index 7e978c83f..e9ae60be2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -102,6 +102,6 @@ def sector_list private def leader - project_users.find_by(position: 2) + project_users.find_by(title: "leader") end end diff --git a/app/models/project_user.rb b/app/models/project_user.rb index d68313262..92dc39837 100644 --- a/app/models/project_user.rb +++ b/app/models/project_user.rb @@ -5,9 +5,6 @@ class ProjectUser < ApplicationRecord # Validations validates_presence_of :project_id - # Enum - enum :position, { default: 0, liaison: 1, leader: 2, assistant: 3 } - scope :active, -> { where(inactive: false) } # Methods diff --git a/app/models/user.rb b/app/models/user.rb index 88526c7da..55dc26291 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class User < ApplicationRecord has_many :bookmarked_workshops, through: :bookmarks, source: :bookmarkable, source_type: "Workshop" has_many :bookmarked_resources, through: :bookmarks, source: :bookmarkable, source_type: "Resource" has_many :bookmarked_events, through: :bookmarks, source: :bookmarkable, source_type: "Event" - has_many :colleagues, -> { select(:user_id, :position, :project_id).distinct }, + has_many :colleagues, -> { select(:user_id, :title, :project_id).distinct }, through: :projects, source: :project_users has_many :communal_reports, through: :projects, source: :reports has_many :events, through: :event_registrations @@ -66,7 +66,7 @@ def self.search_by_params(params) end def has_liasion_position_for?(project_id) - !project_users.where(project_id: project_id, position: 1).first.nil? + !project_users.where(project_id: project_id, title: "liaison").first.nil? end def active_for_authentication? diff --git a/app/views/facilitators/_project_user_fields.html.erb b/app/views/facilitators/_project_user_fields.html.erb index f9b50287d..b49c70cbd 100644 --- a/app/views/facilitators/_project_user_fields.html.erb +++ b/app/views/facilitators/_project_user_fields.html.erb @@ -17,7 +17,7 @@ as: :text, input_html: { rows: 1, - value: f.object.title || f.object.position, + value: f.object.title, } %> @@ -38,6 +38,6 @@ <% else %>
<%= "Last logged in #{user.last_logged_in}" %>
diff --git a/app/views/users/_project_user_fields.html.erb b/app/views/users/_project_user_fields.html.erb index a81060233..3bee547d4 100644 --- a/app/views/users/_project_user_fields.html.erb +++ b/app/views/users/_project_user_fields.html.erb @@ -17,7 +17,7 @@ as: :text, input_html: { rows: 1, - value: f.object.title || f.object.position, + value: f.object.title, } %>