From eb2c96adde85a57f0313ff54bce816391f8f1e37 Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Tue, 10 Mar 2026 15:32:57 +0000 Subject: [PATCH] CLDC-4157: Remove redundant scheme hint functions --- app/models/scheme.rb | 4 ++-- app/views/schemes/support.html.erb | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 608da02c4..0aa481a1e 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -264,7 +264,7 @@ class Scheme < ApplicationRecord Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s) } end - def support_level_options_with_hints + def self.support_level_options_with_hints hints = { "Low level": "Staff visiting once a week, fortnightly or less.", "Medium level": "Staff on site daily or making frequent visits with some out-of-hours cover.", @@ -273,7 +273,7 @@ class Scheme < ApplicationRecord Scheme.support_types.keys.excluding("Missing").excluding("Floating support").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints[key.to_sym]) } end - def intended_length_of_stay_options_with_hints + def self.intended_length_of_stay_options_with_hints hints = { "Very short stay": "Up to one month.", "Short stay": "Up to one year.", diff --git a/app/views/schemes/support.html.erb b/app/views/schemes/support.html.erb index eca72014f..bdf2312d9 100644 --- a/app/views/schemes/support.html.erb +++ b/app/views/schemes/support.html.erb @@ -12,23 +12,15 @@ <%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %> <%= govuk_inset_text(text: "Only update a scheme if you’re fixing an error. If the scheme is changing, create a new scheme.") if @scheme.confirmed? %> - <% support_level_options_hints = { "Low level": "Staff visiting once a week, fortnightly or less.", "Medium level": "Staff on site daily or making frequent visits with some out-of-hours cover.", "High level": "Intensive level of staffing provided on a 24-hour basis." } %> - - <% support_level_options_with_hints = Scheme.support_types.keys.excluding("Missing").excluding("Floating support").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: support_level_options_hints[key.to_sym]) } %> - <%= f.govuk_collection_radio_buttons :support_type, - support_level_options_with_hints, + Scheme.support_level_options_with_hints, :id, :name, :description, legend: { text: "Level of support given", size: "m" } %> - <% intended_length_of_stay_options_hints = { "Very short stay": "Up to one month.", "Short stay": "Up to one year.", "Medium stay": "More than one year but with an expectation to move on.", "Permanent": "Provides a home for life with no requirement for the tenant to move." } %> - - <% intended_length_of_stay_options_with_hints = Scheme.intended_stays.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: intended_length_of_stay_options_hints[key.to_sym]) } %> - <%= f.govuk_collection_radio_buttons :intended_stay, - intended_length_of_stay_options_with_hints, + Scheme.intended_length_of_stay_options_with_hints, :id, :name, :description,