Skip to content

Commit

Permalink
add index on family to speed up sep eligible filter (#4827)
Browse files Browse the repository at this point in the history
* add index to speed up sep eligible filter

* fix rubocop
  • Loading branch information
saipraveen18 authored and bbodine1 committed Dec 18, 2024
1 parent 51d057f commit 8047345
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class Family
index({"irs_groups.hbx_assigned_id" => 1})

index({"special_enrollment_periods._id" => 1})
index({ "special_enrollment_periods.start_on" => 1, "special_enrollment_periods.end_on" => 1 })

index({"family_members.person_id" => 1, hbx_assigned_id: 1})

Expand Down
9 changes: 8 additions & 1 deletion spec/models/family_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2296,4 +2296,11 @@
Family.remove_indexes
Family.create_indexes
end
end

it 'has the correct index on special_enrollment_periods fields' do
indexes = Family.index_specifications
expected_index = {:"special_enrollment_periods.start_on" => 1, :"special_enrollment_periods.end_on" => 1}

expect(indexes.map(&:key)).to include(expected_index)
end
end

0 comments on commit 8047345

Please sign in to comment.