Its been a while

This commit is contained in:
Jason Jordan
2026-07-23 10:32:51 -04:00
parent 5a90ea6e14
commit 56009fa158
70 changed files with 686 additions and 147 deletions
@@ -3,23 +3,43 @@ module IdCardQueueService
def initialize(pl_plan_keys = nil)
if pl_plan_keys
@employer_pl_plan_keys = pl_plan_keys
@employer_pl_plan_keys = Array.wrap(pl_plan_keys)
else
@employer_pl_plan_keys = IdCard::Setup.active.pluck(:pl_plan_key).join(',')
@employer_pl_plan_keys = IdCard::Setup.active.pluck(:pl_plan_key)
end
end
def call
raw_employers_member_keys = CallStoredProc.new('HLGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
format_employers_member_keys(raw_employers_member_keys)
employer_member_keys = @employer_pl_plan_keys.map do |pl_plan_key|
queued_employer_members = Vhcs::VwmbMember.joins('
INNER JOIN "CLDocument" ON "CLDocument"."RecipientKey" = "VWMBMember"."MBMemberKey"
').select('
"VWMBMember"."PBEntityKey"
').where('
"CLDocument"."DocStatus" <> ?
AND "CLDocument"."PLPlanKey" = ?
AND "CLDocument"."PrintDate" IS NULL
AND "CLDocument"."CreateDate" > ?',
"Printed", pl_plan_key, Date.new(2026, 7, 17)
).pluck(:pb_entity_key)
if queued_employer_members.present?
{
pl_plan_key: pl_plan_key,
member_keys: queued_employer_members
}
else
""
end
end
employer_member_keys.compact_blank
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)