Prod build process

This commit is contained in:
Jason Jordan
2026-05-06 13:28:16 -04:00
parent 1d9025276d
commit e0101be567
223 changed files with 1861 additions and 7105 deletions
+18 -8
View File
@@ -4,6 +4,11 @@ module IdCard
has_many :plan_benefits, dependent: :destroy
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
validates :title, presence: true
validates :pb_product_key, :pl_plan_key, presence: true, if: -> { setup&.active }
validates :pb_product_key, uniqueness: true, allow_nil: true
validate :validate_plan_benefits_count, unless: -> { template }
scope :templates, -> { where(template: true) }
FARIOS_BENEFIT_FIELDS = ["Primary Visit", "Specialist Visit", "Urgent Care", "INN-Ind Ded", "INN-Family Ded", "OON-Ind Ded", "OON-Family Ded", "Co-Insurance", "INN-Ind OOP", "INN-Family OOP", "OON-Ind OOP", "OON-Family OOP", "Emergency Room", "Preventive Care"].freeze
@@ -39,10 +44,6 @@ module IdCard
class << self
# def templates
# active_templates.map(&:format_template)
# end
def permitted_params(params)
params.require(:id_card_setup).permit(
plans_attributes: [
@@ -66,11 +67,20 @@ module IdCard
private
def build_and_create_default_benefits
benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
benefits.each do |ben|
id_card_plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
def validate_plan_benefits_count
plan_benefits_size = plan_benefits.size
template_benefits_size = case setup&.card_template
when "TandemlocIDCard"
TANDEMLOC_BENEFIT_FIELDS.size
when "SmartIDCard"
SMART_BENEFIT_FIELDS.size
else
FARIOS_BENEFIT_FIELDS.size
end
unless plan_benefits_size == template_benefits_size
errors.add(:base, "Plan Benefits size (#{plan_benefits_size}) does not match ID Card Template (#{template_benefits_size})")
end
end
end
end