automation and view updates

This commit is contained in:
Jason Jordan
2026-04-17 15:35:10 -04:00
parent 247a075c9c
commit 7ab1143db8
30 changed files with 124704 additions and 602 deletions
@@ -0,0 +1,27 @@
module AutomationService
class BatchEmployerUpdate
def initialize(pl_plan_keys)
@pl_plan_keys = pl_plan_keys
end
def call
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader
WHERE ActiveInactive = 'Active' AND PLPlanKey IN (#{@pl_plan_keys.join(',')})"
employer_plan_headers = VhcsRecord.connection.select_all(sql_query)
employer_update_futures = employer_plan_headers.map do |employer_plan_header|
Concurrent::Future.execute do
ActiveRecord::Base.connection_pool.with_connection do
UpdateEmployerJob.perform_later(employer_plan_header: employer_plan_header)
end
end
end
employer_update_futures.map(&:value)
end
end
end
# AutomationService::MemberUpdate('13', 337710)
@@ -21,13 +21,16 @@ module AutomationService
member_update_futures = vw_mb_members.map do |vw_mb_member|
Concurrent::Future.execute do
ActiveRecord::Base.connection_pool.with_connection do
UpdateMemberJob.perform_now(@pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental, vw_mb_member)
UpdateMemberJob.perform_now(vw_mb_member.pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental, vw_mb_member)
end
end
end
member_updates = member_update_futures.map(&:value).compact
employer.members = member_updates
if member_updates.empty? && employer.id_card_setup.active
employer.active = false
end
employer.save
end
@@ -0,0 +1,22 @@
module AutomationService
class EmployerPlansUpdate
def initialize(pl_plan_key)
@pl_plan_key = pl_plan_key
end
def call
# employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
# card_setup = employer.id_card_setup
UpdateEmployerPlansJob.new.perform(@pl_plan_key)
# if employer.present?
# employer.save
# else
# Member.find_by(pb_entity_key: vw_mb_member[:pb_entity_key]).destroy
# end
end
end
end
# AutomationService::MemberUpdate('13', 337710)
@@ -1,15 +1,15 @@
module AutomationService
class EmployerUpdate
def initialize(pl_plan_key, full_sync = false)
@pl_plan_key = pl_plan_key
def initialize(employer_identifier, full_sync = false)
@employer_identifier = employer_identifier
@full_sync = full_sync
end
def call
# employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
# employer = Employer.includes(:id_card_setup).find_by(employer_identifier: @employer_identifier)
# card_setup = employer.id_card_setup
UpdateEmployerJob.new.perform(@pl_plan_key, {}, @full_sync)
UpdateEmployerJob.new.perform(employer_identifier: @employer_identifier, full_sync: @full_sync)
# if employer.present?
# employer.save
# else