From 5af35df14688b9ea68361d09425b97817acaf334 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 27 Oct 2021 11:38:53 +0100 Subject: [PATCH] add fixed_term_tenancy pattern to api docs and make it dynamically not required --- app/models/case_log.rb | 4 ++++ docs/api/DLUHC-CORE-Data.v1.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 6b3950c6e..0ff5e9c95 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -186,6 +186,10 @@ private dynamically_not_required << "net_income_frequency" end + if tenancy_type == "Fixed term – Secure" + dynamically_not_required << "fixed_term_tenancy" + end + required.delete_if { |key, _value| dynamically_not_required.include?(key) } end end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index f50e096fb..64d5ca517 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -873,7 +873,8 @@ }, "fixed_term_tenancy": { "type": "string", - "minLength": 1 + "minLength": 1, + "pattern": "((?!1|0)([0-9][0-9]))+" }, "tenancy_type": { "type": "string",