Browse Source

feat: tidy up active readouts

pull/1830/head
natdeanlewissoftwire 3 years ago
parent
commit
ea14d003ce
  1. 8
      app/models/form/lettings/questions/stock_owner.rb

8
app/models/form/lettings/questions/stock_owner.rb

@ -27,13 +27,7 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question
Organisation.where(holds_own_stock: true).pluck(:id, :name).to_h Organisation.where(holds_own_stock: true).pluck(:id, :name).to_h
else else
stock_owners = user.organisation.stock_owners stock_owners = user.organisation.stock_owners
.map { |stock_owner| .map { |stock_owner| [stock_owner.id, stock_owner.name] }.to_h
# if user.organisation.absorbed_organisations.find { |absorbed_org| absorbed_org.stock_owners.include?(stock_owner) }.present?
# [stock_owner.id, "#{stock_owner.name} (Active as of #{user.organisation.absorbed_organisations.find { |absorbed_org| absorbed_org.stock_owners.include?(stock_owner) }.merge_date})"]
# else
[stock_owner.id, stock_owner.name]
# end
}.to_h
absorbed_stock_owning_orgs = user.organisation.absorbed_organisations absorbed_stock_owning_orgs = user.organisation.absorbed_organisations
.where(holds_own_stock: true) .where(holds_own_stock: true)
.map { |org| [org.id, "#{org.name} (Inactive as of #{org.merge_date.to_time.to_formatted_s(:govuk_date)})"] }.to_h .map { |org| [org.id, "#{org.name} (Inactive as of #{org.merge_date.to_time.to_formatted_s(:govuk_date)})"] }.to_h

Loading…
Cancel
Save