From be3e131757f684929d18ed4474ab9f95605fac66 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 22 Nov 2024 14:34:55 +0000 Subject: [PATCH] Adjust when to hide org field in scheme creation --- app/views/schemes/details.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb index 71f924782..2e56b1c8f 100644 --- a/app/views/schemes/details.html.erb +++ b/app/views/schemes/details.html.erb @@ -49,11 +49,13 @@ :description, legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> - <% if current_user.data_coordinator? && current_user.organisation.stock_owners.count.zero? && !current_user.organisation.has_recent_absorbed_organisations? %> + <% scheme_owning_organisation_options = owning_organisation_options(current_user) %> + + <% if scheme_owning_organisation_options.count == 1 %> <%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> <% else %> <%= f.govuk_collection_select :owning_organisation_id, - owning_organisation_options(current_user), + scheme_owning_organisation_options, :id, :name, label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" },