Skip to content

Commit

Permalink
updating for including second gpm to check applied aptc rather than e…
Browse files Browse the repository at this point in the history
…ligibility (#168)

* updating npt aqhp check to consider applied aptc rather than eligibility

* updating spec for new indicator

* removing to float since already returned as float

* adding back to_f as it is needed
  • Loading branch information
erubinst authored Jan 8, 2025
1 parent 1338276 commit 4f5c06f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def construct_annual_premiums(months_of_year)
end

def construct_coverage_information(insurance_policy, covered_individuals, tax_household)
has_applied_aptc = false
(1..12).collect do |month|
enrollments_for_month = insurance_policy.enrollments_for_month(month, insurance_policy.start_on.year)
if insurance_policy.aasm_state == "canceled"
Expand All @@ -431,8 +432,11 @@ def construct_coverage_information(insurance_policy, covered_individuals, tax_ho
next unless any_thh_members_enrolled?(tax_household, enrollments_for_month)
next if enrollments_tax_household_for_month_empty?(enrollments_for_month, tax_household)

aptc_tax_credit = insurance_policy.applied_aptc_amount_for(enrollments_for_month, month, tax_household)
has_applied_aptc = true if aptc_tax_credit.to_f > 0.0

# if npt and mid month end date, do not include that month if aqhp
next if insurance_policy.term_for_np && mid_month_end?(insurance_policy.end_on, month) && tax_household.is_aqhp
next if insurance_policy.term_for_np && mid_month_end?(insurance_policy.end_on, month) && has_applied_aptc

if tax_household.is_aqhp && covered_individuals.present?
update_covered_individuals_end_date(covered_individuals, enrollments_for_month, tax_household)
Expand All @@ -442,7 +446,6 @@ def construct_coverage_information(insurance_policy, covered_individuals, tax_ho
pediatric_dental_pre = enrollments_for_month.first
&.pediatric_dental_premium(enrollments_for_month, thh_members, month)
pre_amt_tot = calculate_ehb_premium_for(insurance_policy, tax_household, enrollments_for_month, month)
aptc_tax_credit = insurance_policy.applied_aptc_amount_for(enrollments_for_month, month, tax_household)

slcsp = insurance_policy.fetch_slcsp_premium(enrollments_for_month, month, tax_household, aptc_tax_credit)
total_premium = format('%.2f', (pre_amt_tot.to_f + pediatric_dental_pre))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
let(:enrollment_2_subscriber) { FactoryBot.build(:enrolled_member, person: subscriber_person) }

let!(:aqhp_tax_household_1) { FactoryBot.create(:tax_household, is_aqhp: true) }
let!(:uqhp_tax_household_1) { FactoryBot.create(:tax_household, is_aqhp: false) }
let!(:uqhp_tax_household_1) { FactoryBot.create(:tax_household) }

let!(:aqhp_tax_household_member_1) do
FactoryBot.create(:tax_household_member, tax_household: aqhp_tax_household_1, person: subscriber_person,
Expand Down Expand Up @@ -560,17 +560,20 @@

let!(:aqhp_enrollment_tax_household_1) do
FactoryBot.create(:enrollments_tax_households, enrollment_id: enrollment_npt_eom.id,
tax_household_id: aqhp_tax_household_1.id)
tax_household_id: aqhp_tax_household_1.id,
applied_aptc: Money.new(100.0))
end

let!(:aqhp_enrollment_tax_household_2) do
FactoryBot.create(:enrollments_tax_households, enrollment_id: enrollment_npt_mid_month.id,
tax_household_id: aqhp_tax_household_1.id)
tax_household_id: aqhp_tax_household_1.id,
applied_aptc: Money.new(100.0))
end

let!(:uqhp_enrollment_tax_household_1) do
FactoryBot.create(:enrollments_tax_households, enrollment_id: enrollment_npt_mid_month_uqhp.id,
tax_household_id: uqhp_tax_household_1.id)
tax_household_id: uqhp_tax_household_1.id,
applied_aptc: Money.new(0.0))
end

it "should return success on eom npt policies" do
Expand All @@ -587,7 +590,6 @@
it "should include mid month for uqhp npt policies" do
result = subject.call({ insurance_policy: npt_mid_month_uqhp_insurance_policy })
expect(result.value![:aptc_csr_tax_households][0][:months_of_year].count).to eq 3
print(result.value![:aptc_csr_tax_households][0][:months_of_year])
expect(result.success?).to be_truthy
end
end
Expand Down

0 comments on commit 4f5c06f

Please sign in to comment.