From fa978c41e634c8a308ff2e34c0749668d648a286 Mon Sep 17 00:00:00 2001 From: Stefanos Hadjipetrou Date: Tue, 29 Oct 2024 16:12:37 +0200 Subject: [PATCH] fix: principal recipient sub type filter --- src/utils/filtering/financialIndicators.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/utils/filtering/financialIndicators.ts b/src/utils/filtering/financialIndicators.ts index 2899338..006b718 100644 --- a/src/utils/filtering/financialIndicators.ts +++ b/src/utils/filtering/financialIndicators.ts @@ -136,6 +136,20 @@ export function filterFinancialIndicators( }(${principalRecipients.join(filtering.multi_param_separator)})`; } + const principalRecipientSubTypes = _.filter( + _.get(params, 'principalRecipientSubTypes', '').split(','), + (o: string) => o.length > 0, + ).map( + (principalRecipientSubType: string) => `'${principalRecipientSubType}'`, + ); + if (principalRecipientSubTypes.length > 0) { + str += `${str.length > 0 ? ' AND ' : ''}${ + MAPPING.principalRecipientSubType + }${filtering.in}(${principalRecipientSubTypes.join( + filtering.multi_param_separator, + )})`; + } + const principalRecipientTypes = _.filter( _.get(params, 'principalRecipientTypes', '').split(','), (o: string) => o.length > 0,