From f6524949c29390105f41bad43744fb672c316374 Mon Sep 17 00:00:00 2001 From: "saish.borkar" Date: Thu, 3 Oct 2024 16:05:22 +0530 Subject: [PATCH 1/3] filter condition for subEntities added --- generics/services/form.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generics/services/form.js b/generics/services/form.js index c24fe9df..7caf2e72 100644 --- a/generics/services/form.js +++ b/generics/services/form.js @@ -34,9 +34,11 @@ const configForStateLocation = function ( stateLocationCode, entityKey ) { return fieldInstance.code == messageConstants.common.PERSONA })[0].children.administrator; + let allowedLocationFields = ["state", "district", "block", "cluster", "school"]; + //Entity type is stored in a key called code - let subEntities = subEntityData.map( subEntity => { - return subEntity.code; + let subEntities = subEntityData.filter( subEntity => { + if(allowedLocationFields.includes(subEntity.code)) return subEntity.code; }) //set cache data for given state let setCache = cache.setValue(entityKey, subEntities, messageConstants.common.CACHE_TTL); From cfbaafcdf31142af44807fba6318aa2d5e2446da Mon Sep 17 00:00:00 2001 From: "saish.borkar" Date: Thu, 3 Oct 2024 16:07:45 +0530 Subject: [PATCH 2/3] correction --- generics/services/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generics/services/form.js b/generics/services/form.js index 7caf2e72..1e7294e1 100644 --- a/generics/services/form.js +++ b/generics/services/form.js @@ -39,7 +39,7 @@ const configForStateLocation = function ( stateLocationCode, entityKey ) { //Entity type is stored in a key called code let subEntities = subEntityData.filter( subEntity => { if(allowedLocationFields.includes(subEntity.code)) return subEntity.code; - }) + }).map(subEntity => subEntity.code) //set cache data for given state let setCache = cache.setValue(entityKey, subEntities, messageConstants.common.CACHE_TTL); return resolve(subEntities); From 3048c5e4403a4a94ecb8fbfa622f1d568f7774e9 Mon Sep 17 00:00:00 2001 From: "saish.borkar" Date: Thu, 3 Oct 2024 16:09:32 +0530 Subject: [PATCH 3/3] correction --- generics/services/form.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generics/services/form.js b/generics/services/form.js index 1e7294e1..c7d281aa 100644 --- a/generics/services/form.js +++ b/generics/services/form.js @@ -38,7 +38,11 @@ const configForStateLocation = function ( stateLocationCode, entityKey ) { //Entity type is stored in a key called code let subEntities = subEntityData.filter( subEntity => { - if(allowedLocationFields.includes(subEntity.code)) return subEntity.code; + if(allowedLocationFields.includes(subEntity.code)){ + return true; + }else { + return false; + } }).map(subEntity => subEntity.code) //set cache data for given state let setCache = cache.setValue(entityKey, subEntities, messageConstants.common.CACHE_TTL);