before adding users
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
module AutomationService
|
||||
class BatchEmployerUpdate
|
||||
|
||||
def initialize(pl_plan_keys)
|
||||
def initialize(pl_plan_keys = nil)
|
||||
@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(',')})"
|
||||
WHERE ActiveInactive = 'Active'"
|
||||
if @pl_plan_keys.present?
|
||||
sql_query = sql_query.concat(" AND PLPlanKey IN (#{@pl_plan_keys.join(',')})")
|
||||
end
|
||||
employer_plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||
|
||||
employer_update_futures = employer_plan_headers.map do |employer_plan_header|
|
||||
|
||||
@@ -6,7 +6,20 @@ module IdCardQueueService
|
||||
end
|
||||
|
||||
def call
|
||||
CallStoredProc.new('BrittonGetQueuedIdCardCountsTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
||||
raw_employers_member_keys = CallStoredProc.new('HLGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_employers_member_keys(raw_employers_member_keys)
|
||||
key_map = { "PlanKey" => :pl_plan_key, "MemberKeys" => :member_keys }
|
||||
|
||||
raw_employers_member_keys.map do |hash|
|
||||
hash["PlanKey"] = hash["PlanKey"].to_s
|
||||
hash["MemberKeys"] = hash["MemberKeys"].split(", ").map(&:to_i)
|
||||
hash.transform_keys(key_map)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user