Skip to content

Commit

Permalink
includes cobra employees in eligible to enroll employees (#2462)
Browse files Browse the repository at this point in the history
Co-authored-by: utkarsh7989 <utkarsh7989@gmail.com>
  • Loading branch information
sri49 and utkarsh7989 authored Sep 28, 2023
1 parent ee67d85 commit 6243411
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/census_employee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,13 @@ class CensusEmployee < CensusMember
matched.by_benefit_group_assignment_ids(benefit_group_assignment_ids)
}

# includes cobra employees in eligible to enroll non terminated employees. ref: 102639
scope :census_employees_active_on, lambda { |date|
where(
"$or" => [
{"employment_terminated_on" => nil},
{"employment_terminated_on" => {"$gte" => date}}
{"employment_terminated_on" => {"$gte" => date}},
{"aasm_state" => "cobra_linked"}
]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,17 @@ module BenefitSponsors
expect(renewal_application.active_census_employees_under_py.count).to eq 4
end

it 'should return the cobra EEs' do
expect(renewal_application.active_census_employees_under_py.count).to eq 5
term_date = renewal_application.effective_period.min - 10.days
ce = renewal_application.active_census_employees_under_py.first
ce.aasm_state = 'cobra_linked'
ce.employment_terminated_on = term_date
ce.benefit_group_assignments.last.update(benefit_package_id: renewal_application.benefit_packages.first.id)
ce.save(validate: false)
expect(renewal_application.active_census_employees_under_py.count).to eq 5
end

it 'should not return term pending with prior effective date as term date' do
expect(renewal_application.active_census_employees_under_py.count).to eq 5
term_date = renewal_application.effective_period.min - 10.days
Expand Down

0 comments on commit 6243411

Please sign in to comment.