diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb
index b4b74c2d3..d15711cfd 100644
--- a/app/helpers/check_answers_helper.rb
+++ b/app/helpers/check_answers_helper.rb
@@ -12,25 +12,22 @@ module CheckAnswersHelper
end
def get_answer_label(question, case_log)
- unless question.id == "earnings"
- answer = question.prefix == "£" ? ActionController::Base.helpers.number_to_currency(question.answer_label(case_log), delimiter: ",", format: "%n") : question.answer_label(case_log)
- if answer.present?
- [question.prefix, answer, question.suffix].join("")
+ if question.id == "earnings"
+ linked_question = case_log.form.get_question("incfreq")
+ if question.answer_label(case_log).present? && linked_question.answer_label(case_log).present?
+ suffixes = {
+ "Weekly" => " every week",
+ "Monthly" => " every month",
+ "Yearly" => " every year",
+ }
+ [question.prefix, question.answer_label(case_log), suffixes[linked_question.answer_label(case_log)]].join("")
else
"You didn’t answer this question".html_safe
end
else
- linked_question = case_log.form.get_question("incfreq")
- if(question.answer_label(case_log).present? && linked_question.answer_label(case_log).present?)
- suffix = case linked_question.answer_label(case_log)
- when "Weekly"
- " every week"
- when "Monthly"
- " every month"
- when "Yearly"
- " every year"
- end
- [question.prefix, question.answer_label(case_log), suffix].join("")
+ answer = question.prefix == "£" ? ActionController::Base.helpers.number_to_currency(question.answer_label(case_log), delimiter: ",", format: "%n") : question.answer_label(case_log)
+ if answer.present?
+ [question.prefix, answer, question.suffix].join("")
else
"You didn’t answer this question".html_safe
end
diff --git a/app/models/case_log.rb b/app/models/case_log.rb
index 38e8deb0e..f3984e247 100644
--- a/app/models/case_log.rb
+++ b/app/models/case_log.rb
@@ -243,6 +243,7 @@ private
self.month = startdate.month
self.year = startdate.year
end
+ self.incref = 1 if net_income_known == "Tenant prefers not to say"
self.hhmemb = other_hhmemb + 1 if other_hhmemb.present?
self.renttype = RENT_TYPE_MAPPING[rent_type]
self.lettype = "#{renttype} #{needstype} #{owning_organisation[:provider_type]}" if renttype.present? && needstype.present? && owning_organisation[:provider_type].present?
diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb
index 08b4a8c5f..71940ab99 100644
--- a/spec/factories/case_log.rb
+++ b/spec/factories/case_log.rb
@@ -69,6 +69,7 @@ FactoryBot.define do
offered { 2 }
wchair { "Yes" }
earnings { 68 }
+ incfreq { "Weekly" }
benefits { "Some" }
period { "Every 2 weeks" }
brent { 200 }