diff --git a/app/helpers/question_view_helper.rb b/app/helpers/question_view_helper.rb index 3ff84bc19..f5e92cf1c 100644 --- a/app/helpers/question_view_helper.rb +++ b/app/helpers/question_view_helper.rb @@ -13,6 +13,26 @@ module QuestionViewHelper } end + def answer_option_synonyms(resource) + return unless resource.instance_of?(Scheme) + + resource.locations.map(&:postcode).join(",") + end + + def answer_option_append(resource) + return unless resource.instance_of?(Scheme) + + confirmed_locations_count = resource.locations.confirmed.size + unconfirmed_locations_count = resource.locations.unconfirmed.size + "#{confirmed_locations_count} completed #{'location'.pluralize(confirmed_locations_count)}, #{unconfirmed_locations_count} incomplete #{'location'.pluralize(unconfirmed_locations_count)}" + end + + def answer_option_hint(resource) + return unless resource.instance_of?(Scheme) + + [resource.primary_client_group, resource.secondary_client_group].filter(&:present?).join(", ") + end + private def label_size(page_header, conditional, question) diff --git a/app/models/form/question.rb b/app/models/form/question.rb index de77674e6..56bf7170a 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -226,24 +226,6 @@ class Form::Question label end - def answer_option_synonyms(resource) - return unless resource.respond_to?(:synonyms) - - resource.synonyms - end - - def answer_option_append(resource) - return unless resource.respond_to?(:appended_text) - - resource.appended_text - end - - def answer_option_hint(resource) - return unless resource.respond_to?(:hint) - - resource.hint - end - def answer_selected?(log, answer) return false unless type == "select" diff --git a/app/models/scheme.rb b/app/models/scheme.rb index a190c5d5e..612479e91 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -161,18 +161,6 @@ class Scheme < ApplicationRecord ] end - def synonyms - locations.map(&:postcode).join(",") - end - - def appended_text - "#{confirmed_locations_count} completed #{'location'.pluralize(confirmed_locations_count)}, #{unconfirmed_locations_count} incomplete #{'location'.pluralize(unconfirmed_locations_count)}" - end - - def hint - [primary_client_group, secondary_client_group].filter(&:present?).join(", ") - end - def care_acts_options_with_hints hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } @@ -254,14 +242,4 @@ class Scheme < ApplicationRecord def deactivated? status == :deactivated end - -private - - def confirmed_locations_count - locations.confirmed.size - end - - def unconfirmed_locations_count - locations.unconfirmed.size - end end diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb index c1ee8c3e0..0655d4089 100644 --- a/app/views/form/_select_question.html.erb +++ b/app/views/form/_select_question.html.erb @@ -9,9 +9,9 @@ hint: { text: question.hint_text&.html_safe }) do %> <% answers.each do |answer| %> <% end %>