Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identity_id & unit_factor issue #1100

Merged
merged 14 commits into from
Oct 5, 2017
8 changes: 4 additions & 4 deletions app/controllers/catalog_manager/identities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def associate_with_org_unit
identity = Identity.find identity_id

if rel_type == 'service_provider_organizational_unit'
if not oe.service_providers or (oe.service_providers and not oe.service_providers.map(&:id).include? identity_id)
if not oe.service_providers or (oe.service_providers and not oe.service_providers.pluck(:identity_id).include? identity_id)
# we have a new relationship to create
#identity.create_relationship_to oe.id, 'service_provider_organizational_unit', {"view_draft_status" => false, "is_primary_contact" => false, "hold_emails" => false}
service_provider = oe.service_providers.new
Expand All @@ -43,7 +43,7 @@ def associate_with_org_unit
render :partial => 'catalog_manager/shared/service_providers', :locals => {:entity => oe}

elsif rel_type == 'super_user_organizational_unit'
if not oe.super_users or (oe.super_users and not oe.super_users.map(&:id).include? identity_id)
if not oe.super_users or (oe.super_users and not oe.super_users.pluck(:identity_id).include? identity_id)
# we have a new relationship to create
#identity.create_relationship_to oe.id, 'super_user_organizational_unit'
super_user = oe.super_users.new
Expand All @@ -54,7 +54,7 @@ def associate_with_org_unit
render :partial => 'catalog_manager/shared/super_users', :locals => {:entity => oe}

elsif rel_type == 'clinical_provider_organizational_unit'
if not oe.clinical_providers or (oe.clinical_providers and not oe.clinical_providers.map(&:id).include? identity_id)
if not oe.clinical_providers or (oe.clinical_providers and not oe.clinical_providers.pluck(:identity_id).include? identity_id)
# we have a new relationship to create
#identity.create_relationship_to oe.id, 'super_user_organizational_unit'
clinical_provider = oe.clinical_providers.new
Expand All @@ -65,7 +65,7 @@ def associate_with_org_unit
render :partial => 'catalog_manager/shared/clinical_providers', :locals => {:entity => oe}

elsif rel_type == 'catalog_manager_organizational_unit'
if not oe.catalog_managers or (oe.catalog_managers and not oe.catalog_managers.map(&:id).include? identity_id)
if not oe.catalog_managers or (oe.catalog_managers and not oe.catalog_managers.pluck(:identity_id).include? identity_id)
# we have a new relationship to create
#identity.create_relationship_to oe.id, 'catalog_manager_organizational_unit'
catalog_manager = oe.catalog_managers.new
Expand Down
6 changes: 5 additions & 1 deletion app/models/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ def per_unit_cost(quantity_total=self.quantity)
# factor.
def units_per_package
unit_factor = self.service.displayed_pricing_map.unit_factor
units_per_package = unit_factor || 1
if unit_factor.nil? || unit_factor == 0
units_per_package = 1
else
units_per_package = unit_factor
end

return units_per_package
end
Expand Down