From 2cf4acba8d9e0b03f8dadf57008beb171ee72298 Mon Sep 17 00:00:00 2001 From: Celine Pelletier Date: Tue, 17 Oct 2023 20:45:58 -0400 Subject: [PATCH] feat: SJIP-569 filter to keep only available biospecimen for request report --- .../biospecimen-request/generateBiospecimenRequestFiles.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reports/biospecimen-request/generateBiospecimenRequestFiles.ts b/src/reports/biospecimen-request/generateBiospecimenRequestFiles.ts index 4be5870..5fb77e3 100644 --- a/src/reports/biospecimen-request/generateBiospecimenRequestFiles.ts +++ b/src/reports/biospecimen-request/generateBiospecimenRequestFiles.ts @@ -12,6 +12,7 @@ import { contact, generateStudyTab, wantedFields } from './config'; import { resolveSetsInSqon } from '../../utils/sqonUtils'; import { SheetConfig } from '../types'; import generateTxtFile from '../utils/generateTxtFile'; +import { addConditionAvailableInSqon } from '../utils/getAvailableBiospecimensFromSqon'; /** * Generate and write locally. @@ -102,7 +103,8 @@ const makeReportQuery = async ( ) => { const nestedFields = getNestedFields(extendedConfig); const newSqon = await resolveSetsInSqon(sqon, userId, accessToken); - const query = buildQuery({ nestedFields, filters: newSqon }); + const newSqonForAvailableOnly = addConditionAvailableInSqon(newSqon); + const query = buildQuery({ nestedFields, filters: newSqonForAvailableOnly }); return { query,