Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gigxz committed Feb 5, 2025
1 parent 92b3298 commit b389003
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hmis/app/graphql/types/forms/pick_list_option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,10 @@ def self.available_units_for_enrollment(project, household_id: nil)

# drop units that have different types
hh_unit_type_ids = project.enrollments.where(household_id: household_id).map(&:current_unit_type).compact.map(&:id).uniq
return picklist unless hh_unit_type_ids.any? # household doesn't have a unit type, so no need for further filtering
return picklist if hh_unit_type_ids.empty? # household doesn't have a unit type, so no need for further filtering

# if the household has a unit type, exclude units that don't match
allowed_unit_type_unit_ids = project.units.where(unit_type_id: hh_unit_type_ids).pluck(:id)
allowed_unit_type_unit_ids = project.units.where(unit_type_id: hh_unit_type_ids).pluck(:id).to_set
picklist.filter do |option|
option[:code].in?(allowed_unit_type_unit_ids)
end
Expand Down

0 comments on commit b389003

Please sign in to comment.