Browse Source

feat: update housing provider answer opts to include current HP in db

fix-remove-attr-accessors-from-questions-in-cldc-1723
Sam Seed 2 years ago
parent
commit
443239f3d5
  1. 6
      app/models/form/lettings/questions/stock_owner.rb

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

@ -11,8 +11,14 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question
def answer_options
answer_opts = { "" => "Select an option" }
return answer_opts unless ActiveRecord::Base.connected?
return answer_opts unless current_user
return answer_opts unless log
if log.owning_organisation_id.present?
answer_opts = answer_opts.merge({ log.owning_organisation.id => log.owning_organisation.name })
end
if !current_user.support? && current_user.organisation.holds_own_stock?
answer_opts[current_user.organisation.id] = "#{current_user.organisation.name} (Your organisation)"

Loading…
Cancel
Save