stable, before a refactor

This commit is contained in:
Jason Jordan
2026-03-03 22:53:21 -05:00
parent 4fac3b1036
commit 942d60c3e0
66 changed files with 1321 additions and 194 deletions
+10
View File
@@ -0,0 +1,10 @@
class CardException < ApplicationRecord
belongs_to :employer
has_many :card_exception_items
accepts_nested_attributes_for :card_exception_items, allow_destroy: true, reject_if: :all_blank
VALID_TYPES = ['zipcode', 'state', 'family_id']
validates :type, inclusion: { in: VALID_TYPES,
message: "%{value} is not a valid exception type" }
end
+25
View File
@@ -0,0 +1,25 @@
class CardExceptionItem < ApplicationRecord
belongs_to :card_exception
belongs_to :card_logo_file, optional: true
belongs_to :card_provider, optional: true
validate :only_one_exception_field_present
FIELDS_TO_VALIDATE = [:field_value, :card_logo_file_id, :card_provider_id].freeze
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'effective_date']
validates :field_name, inclusion: { in: VALID_FIELD_NAMES,
message: "%{value} is not a valid Id Card Field Name" }
private
def only_one_exception_field_present
present_fields = FIELDS_TO_VALIDATE.count { |field| self[field].present? }
if present_fields != 1
errors.add(:base, "Only one exception field can be present at a time")
end
end
end
+10
View File
@@ -1,4 +1,14 @@
class CardLogoFile < ApplicationRecord
has_many :employer_card_logos, dependent: :destroy
has_many :employers, through: :employer_card_logos
before_save :round_aspect_ratio
private
def round_aspect_ratio
if self.aspect_ratio.present?
self.aspect_ratio = self.aspect_ratio.round(2)
end
end
end
+4 -1
View File
@@ -22,6 +22,9 @@ class Employer < ApplicationRecord
belongs_to :card_provider, optional: true
belongs_to :card_rx, optional: true
has_many :card_exceptions, dependent: :destroy
accepts_nested_attributes_for :card_exceptions, allow_destroy: true, reject_if: :all_blank
scope :active, -> { where(active: true) }
scope :inactive, -> { where(active: false) }
@@ -128,7 +131,7 @@ class Employer < ApplicationRecord
self.plans.each_with_index do |plan, i|
plan.plan_benefits.each do |bene|
Vhcs::HlEgglestonCardBenefit.create!(
plan_id: plan.plan_id,
plan_id: plan.pb_product_key,
benefit_desc: bene.benefit_desc,
benefit: bene.benefit,
sequence: bene.sequence,
+1 -1
View File
@@ -1,5 +1,5 @@
module Vhcs
class HLEggIdCardDependent < VhcsRecord
class HlEggIdCardDependent < VhcsRecord
self.table_name = 'HLEggIdCardDependent'
+219
View File
@@ -0,0 +1,219 @@
module Vhcs
class HlidCardEggData < VhcsRecord
self.table_name = 'HLIDCardEggData'
alias_attribute :id, :ID
alias_attribute :facility, :Facility
alias_attribute :division, :Division
alias_attribute :full_name, :FullName
alias_attribute :ssn, :SSN
alias_attribute :medical_coverage, :MedicalCoverage
alias_attribute :medical_eff_date, :MedicalEffDate
alias_attribute :medical_group_num, :MedicalGroupNum
alias_attribute :dental_coverage, :DentalCoverage
alias_attribute :dental_eff_date, :DentalEffDate
alias_attribute :dental_group_num, :DentalGroupNum
alias_attribute :card_type, :CardType
alias_attribute :provider_code, :ProviderCode
alias_attribute :provider_line_1, :ProviderLine1
alias_attribute :provider_line_2, :ProviderLine2
alias_attribute :provider_line_3, :ProviderLine3
alias_attribute :provider_line_4, :ProviderLine4
alias_attribute :provider_line_5, :ProviderLine5
alias_attribute :provider_line_6, :ProviderLine6
alias_attribute :provider_line_7, :ProviderLine7
alias_attribute :provider_line_8, :ProviderLine8
alias_attribute :provider_line_9, :ProviderLine9
alias_attribute :provider_line_1_0, :ProviderLine10
alias_attribute :provider_line_1_1, :ProviderLine11
alias_attribute :mail_to, :MailTo
alias_attribute :mail_to_2, :MailTo2
alias_attribute :claim_to_1, :ClaimTo1
alias_attribute :claim_to_2, :ClaimTo2
alias_attribute :claim_to_3, :ClaimTo3
alias_attribute :claim_to_4, :ClaimTo4
alias_attribute :claim_to_5, :ClaimTo5
alias_attribute :claim_to_6, :ClaimTo6
alias_attribute :claim_to_7, :ClaimTo7
alias_attribute :claim_to_8, :ClaimTo8
alias_attribute :claim_to_9, :ClaimTo9
alias_attribute :claim_to_1_0, :ClaimTo10
alias_attribute :claim_to_1_1, :ClaimTo11
alias_attribute :contact_line_1, :ContactLine1
alias_attribute :contact_line_2, :ContactLine2
alias_attribute :contact_line_3, :ContactLine3
alias_attribute :group_number, :GroupNumber
alias_attribute :family_id, :FamilyId
alias_attribute :group_no, :GroupNo
alias_attribute :rx_group_id, :RXGroupID
alias_attribute :help_desk, :HelpDesk
alias_attribute :customer_service, :CustomerService
alias_attribute :web_url, :WebUrl
alias_attribute :expr_1, :Expr1
alias_attribute :line_3, :Line3
alias_attribute :dependent_1, :Dependent1
alias_attribute :dependent_2, :Dependent2
alias_attribute :dependent_3, :Dependent3
alias_attribute :dependent_4, :Dependent4
alias_attribute :dependent_5, :Dependent5
alias_attribute :dependent_6, :Dependent6
alias_attribute :dependent_7, :Dependent7
alias_attribute :dependent_8, :Dependent8
alias_attribute :ben_desc_1, :BenDesc1
alias_attribute :ben_1, :Ben1
alias_attribute :ben_desc_2, :BenDesc2
alias_attribute :ben_2, :Ben2
alias_attribute :ben_desc_3, :BenDesc3
alias_attribute :ben_3, :Ben3
alias_attribute :ben_desc_4, :BenDesc4
alias_attribute :ben_4, :Ben4
alias_attribute :ben_desc_5, :BenDesc5
alias_attribute :ben_5, :Ben5
alias_attribute :ben_desc_6, :BenDesc6
alias_attribute :ben_6, :Ben6
alias_attribute :ben_desc_7, :BenDesc7
alias_attribute :ben_7, :Ben7
alias_attribute :ben_desc_8, :BenDesc8
alias_attribute :ben_8, :Ben8
alias_attribute :ben_desc_9, :BenDesc9
alias_attribute :ben_9, :Ben9
alias_attribute :ben_desc_1_0, :BenDesc10
alias_attribute :ben_1_0, :Ben10
alias_attribute :ben_desc_1_1, :BenDesc11
alias_attribute :ben_1_1, :Ben11
alias_attribute :ben_desc_1_2, :BenDesc12
alias_attribute :ben_1_2, :Ben12
alias_attribute :ben_desc_1_3, :BenDesc13
alias_attribute :ben_1_3, :Ben13
alias_attribute :ben_desc_1_4, :BenDesc14
alias_attribute :ben_1_4, :Ben14
alias_attribute :pl_plan_key, :PLPlanKey
alias_attribute :primary_mb_member_key, :PrimaryMBMemberKey
alias_attribute :ppo_lookup_1, :PPOLookup1
alias_attribute :ppo_lookup_2, :PPOLookup2
alias_attribute :precert_1, :Precert1
alias_attribute :precert_2, :Precert2
alias_attribute :precert_3, :Precert3
alias_attribute :precert_4, :Precert4
alias_attribute :precert_5, :Precert5
alias_attribute :precert_6, :Precert6
alias_attribute :misc_data, :MiscData
alias_attribute :ppo_data, :PPOData
alias_attribute :ppo_data_2, :PPOData2
alias_attribute :ppo_data_3, :PPOData3
alias_attribute :last_name, :LastName
alias_attribute :provider_line_1_2, :ProviderLine12
alias_attribute :claim_to_1_2, :ClaimTo12
def attributes
rails_like = {
id: self.id,
facility: self.facility,
division: self.division,
full_name: self.full_name,
ssn: self.ssn,
medical_coverage: self.medical_coverage,
medical_eff_date: self.medical_eff_date,
medical_group_num: self.medical_group_num,
dental_coverage: self.dental_coverage,
dental_eff_date: self.dental_eff_date,
dental_group_num: self.dental_group_num,
card_type: self.card_type,
provider_code: self.provider_code,
provider_line_1: self.provider_line_1,
provider_line_2: self.provider_line_2,
provider_line_3: self.provider_line_3,
provider_line_4: self.provider_line_4,
provider_line_5: self.provider_line_5,
provider_line_6: self.provider_line_6,
provider_line_7: self.provider_line_7,
provider_line_8: self.provider_line_8,
provider_line_9: self.provider_line_9,
provider_line_1_0: self.provider_line_1_0,
provider_line_1_1: self.provider_line_1_1,
mail_to: self.mail_to,
mail_to_2: self.mail_to_2,
claim_to_1: self.claim_to_1,
claim_to_2: self.claim_to_2,
claim_to_3: self.claim_to_3,
claim_to_4: self.claim_to_4,
claim_to_5: self.claim_to_5,
claim_to_6: self.claim_to_6,
claim_to_7: self.claim_to_7,
claim_to_8: self.claim_to_8,
claim_to_9: self.claim_to_9,
claim_to_1_0: self.claim_to_1_0,
claim_to_1_1: self.claim_to_1_1,
contact_line_1: self.contact_line_1,
contact_line_2: self.contact_line_2,
contact_line_3: self.contact_line_3,
group_number: self.group_number,
family_id: self.family_id,
group_no: self.group_no,
rx_group_id: self.rx_group_id,
help_desk: self.help_desk,
customer_service: self.customer_service,
web_url: self.web_url,
expr_1: self.expr_1,
line_3: self.line_3,
dependent_1: self.dependent_1,
dependent_2: self.dependent_2,
dependent_3: self.dependent_3,
dependent_4: self.dependent_4,
dependent_5: self.dependent_5,
dependent_6: self.dependent_6,
dependent_7: self.dependent_7,
dependent_8: self.dependent_8,
ben_desc_1: self.ben_desc_1,
ben_1: self.ben_1,
ben_desc_2: self.ben_desc_2,
ben_2: self.ben_2,
ben_desc_3: self.ben_desc_3,
ben_3: self.ben_3,
ben_desc_4: self.ben_desc_4,
ben_4: self.ben_4,
ben_desc_5: self.ben_desc_5,
ben_5: self.ben_5,
ben_desc_6: self.ben_desc_6,
ben_6: self.ben_6,
ben_desc_7: self.ben_desc_7,
ben_7: self.ben_7,
ben_desc_8: self.ben_desc_8,
ben_8: self.ben_8,
ben_desc_9: self.ben_desc_9,
ben_9: self.ben_9,
ben_desc_1_0: self.ben_desc_1_0,
ben_1_0: self.ben_1_0,
ben_desc_1_1: self.ben_desc_1_1,
ben_1_1: self.ben_1_1,
ben_desc_1_2: self.ben_desc_1_2,
ben_1_2: self.ben_1_2,
ben_desc_1_3: self.ben_desc_1_3,
ben_1_3: self.ben_1_3,
ben_desc_1_4: self.ben_desc_1_4,
ben_1_4: self.ben_1_4,
pl_plan_key: self.pl_plan_key,
primary_mb_member_key: self.primary_mb_member_key,
ppo_lookup_1: self.ppo_lookup_1,
ppo_lookup_2: self.ppo_lookup_2,
precert_1: self.precert_1,
precert_2: self.precert_2,
precert_3: self.precert_3,
precert_4: self.precert_4,
precert_5: self.precert_5,
precert_6: self.precert_6,
misc_data: self.misc_data,
ppo_data: self.ppo_data,
ppo_data_2: self.ppo_data_2,
ppo_data_3: self.ppo_data_3,
last_name: self.last_name,
provider_line_1_2: self.provider_line_1_2,
claim_to_1_2: self.claim_to_1_2,
}
super.merge(rails_like)
end
end
end
+1 -1
View File
@@ -1,5 +1,5 @@
module Vhcs
class HLIDCardsEgg < VhcsRecord
class HlidCardsEgg < VhcsRecord
self.table_name = 'HLIDCardsEgg'