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,