From b2e988c148deff0e4aa621a28e7a18d184b82886 Mon Sep 17 00:00:00 2001 From: mari <2312138+masimons@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:08:13 -0300 Subject: [PATCH 1/4] prevent forecasted grants from surfacing during dev work --- .../client/src/helpers/featureFlags/index.js | 4 +++ packages/server/.env.example | 1 + packages/server/__tests__/db/db.test.js | 10 ++++++ packages/server/src/db/index.js | 33 +++++++++++++++---- packages/server/src/lib/email.js | 2 +- packages/server/src/routes/grants.js | 5 ++- terraform/prod.tfvars | 5 +-- terraform/staging.tfvars | 1 + 8 files changed, 50 insertions(+), 11 deletions(-) diff --git a/packages/client/src/helpers/featureFlags/index.js b/packages/client/src/helpers/featureFlags/index.js index 0cb33bd8c..756673ded 100644 --- a/packages/client/src/helpers/featureFlags/index.js +++ b/packages/client/src/helpers/featureFlags/index.js @@ -20,3 +20,7 @@ export function followNotesEnabled() { export function grantNotesLimit() { return parseInt(getFeatureFlags().grantNotesLimit, 10) || 4; } + +export function showForecastedGrants() { + return getFeatureFlags().showForecastedGrants === true; +} diff --git a/packages/server/.env.example b/packages/server/.env.example index 2e59ee13f..23dcc8cd8 100644 --- a/packages/server/.env.example +++ b/packages/server/.env.example @@ -10,6 +10,7 @@ API_DOMAIN=http://localhost:8080 ENABLE_GRANTS_SCRAPER=true SHARE_TERMINOLOGY_ENABLED=true +SHOW_FORECASTED_GRANTS=true GRANTS_SCRAPER_DATE_RANGE=7 GRANTS_SCRAPER_DELAY=1000 NODE_OPTIONS=--max_old_space_size=1024 diff --git a/packages/server/__tests__/db/db.test.js b/packages/server/__tests__/db/db.test.js index fedb7b15b..8b79f470c 100644 --- a/packages/server/__tests__/db/db.test.js +++ b/packages/server/__tests__/db/db.test.js @@ -774,6 +774,16 @@ describe('db', () => { const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy); expect(result.length).to.equal(1); }); + it('does not return forecasted grants', async () => { + const newGrant = fixtures.grants.healthAide; + newGrant.grant_id = '444817'; + newGrant.open_date = new Date('2022-06-21'); + newGrant.opportunity_status = 'forecasted'; + await knex(TABLES.grants).insert(Object.values([newGrant])); + const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy); + const forecastedGrant = result.filter((grant) => grant.grant_id === '444817'); + expect(forecastedGrant.length).to.equal(0); + }); }); context('createUser', () => { diff --git a/packages/server/src/db/index.js b/packages/server/src/db/index.js index b0cff8338..ac44d0eb6 100755 --- a/packages/server/src/db/index.js +++ b/packages/server/src/db/index.js @@ -349,7 +349,7 @@ async function getNewGrantsForAgency(agency) { .select(knex.raw(`${TABLES.grants}.*, count(*) OVER() AS total_grants`)) .modify(helpers.whereAgencyCriteriaMatch, agencyCriteria) .modify((qb) => { - qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') }); + qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') }) }) .limit(3); @@ -713,7 +713,7 @@ function addCsvData(qb) { tenantId: number agencyId: number */ -async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, agencyId, toCsv) { +async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, agencyId, toCsv, showForecastedGrants=false) { const errors = validateSearchFilters(filters); if (errors.length > 0) { throw new Error(`Invalid filters: ${errors.join(', ')}`); @@ -751,6 +751,7 @@ async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, CASE WHEN grants.archive_date <= now() THEN 'archived' WHEN grants.close_date <= now() THEN 'closed' + WHEN grants.open_date > now() THEN 'forecasted' ELSE 'posted' END as opportunity_status `)) @@ -758,6 +759,11 @@ async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, NULLIF(grants.award_ceiling, 0) as award_ceiling `)) .modify((qb) => grantsQuery(qb, filters, agencyId, orderingParams, paginationParams)) + .modify((qb) => { + if (!showForecastedGrants) { + qb.whereNot({ opportunity_status: 'forecasted' }); + } + }) .select(knex.raw(` count(*) OVER() AS full_count `)) @@ -841,7 +847,7 @@ async function enhanceGrantData(tenantId, data) { } async function getGrants({ - currentPage, perPage, tenantId, filters, orderBy, searchTerm, orderDesc, + currentPage, perPage, tenantId, filters, orderBy, searchTerm, orderDesc, showForecastedGrants } = {}) { const data = await knex(TABLES.grants) .modify((queryBuilder) => { @@ -852,6 +858,9 @@ async function getGrants({ .orWhere(`${TABLES.grants}.title`, '~*', searchTerm), ); } + if (!showForecastedGrants) { + queryBuilder.andWhereNot(`${TABLES.grants}.opportunity_status`, 'forecasted'); + } if (filters) { if (filters.interestedByUser || filters.positiveInterest || filters.result || filters.rejected || filters.interestedByAgency) { queryBuilder.join(TABLES.grants_interested, `${TABLES.grants}.grant_id`, `${TABLES.grants_interested}.grant_id`) @@ -1002,17 +1011,27 @@ async function getGrants({ return { data: dataWithAgency, pagination }; } -async function getGrant({ grantId }) { +async function getGrant({ grantId, showForecastedGrants }) { const results = await knex.table(TABLES.grants) .select('*') - .where({ grant_id: grantId }); + .where({ grant_id: grantId }) + .modify((queryBuilder) => { + if (!showForecastedGrants) { + queryBuilder.whereNot({ opportunity_status: 'forecasted' }); + } + }) return results[0]; } -async function getSingleGrantDetails({ grantId, tenantId }) { +async function getSingleGrantDetails({ grantId, tenantId, showForecastedGrants }) { const results = await knex.table(TABLES.grants) .select('*') - .where({ grant_id: grantId }); + .where({ grant_id: grantId }) + .modify((queryBuilder) => { + if (!showForecastedGrants) { + queryBuilder.whereNot({ opportunity_status: 'forecasted' }); + } + }) const enhancedResults = await enhanceGrantData(tenantId, results); return enhancedResults.length ? enhancedResults[0] : null; } diff --git a/packages/server/src/lib/email.js b/packages/server/src/lib/email.js index 88331428c..359284cc0 100644 --- a/packages/server/src/lib/email.js +++ b/packages/server/src/lib/email.js @@ -423,7 +423,7 @@ async function sendGrantAssignedEmails({ grantId, agencyIds, userId }) { i. Send email */ try { - const grant = await db.getGrant({ grantId }); + const grant = await db.getGrant({ grantId, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS }); const grantDetail = await buildGrantDetail(grant, notificationType.grantAssignment); const agencies = await db.getAgenciesByIds(agencyIds); await asyncBatch( diff --git a/packages/server/src/routes/grants.js b/packages/server/src/routes/grants.js index d7577e00e..872212506 100755 --- a/packages/server/src/routes/grants.js +++ b/packages/server/src/routes/grants.js @@ -42,6 +42,7 @@ router.get('/', requireUser, async (req, res) => { }, orderBy: req.query.orderBy, orderDesc: req.query.orderDesc, + showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS, }); res.json(grants); }); @@ -92,6 +93,7 @@ router.get('/next', requireUser, async (req, res) => { user.tenant_id, user.agency_id, false, + process.env.SHOW_FORECASTED_GRANTS, ); return res.json(grants); @@ -101,7 +103,7 @@ router.get('/next', requireUser, async (req, res) => { router.get('/:grantId/grantDetails', requireUser, async (req, res) => { const { grantId } = req.params; const { user } = req.session; - const response = await db.getSingleGrantDetails({ grantId, tenantId: user.tenant_id }); + const response = await db.getSingleGrantDetails({ grantId, tenantId: user.tenant_id, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS }); res.json(response); }); @@ -128,6 +130,7 @@ router.get('/exportCSVNew', requireUser, async (req, res) => { user.tenant_id, user.agency_id, true, + process.env.SHOW_FORECASTED_GRANTS, ); // Generate CSV diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index c6255dc75..2d0e629d1 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -75,8 +75,9 @@ api_enable_saved_search_grants_digest = true api_enable_grant_digest_scheduled_task = true api_log_retention_in_days = 30 api_container_environment = { - NEW_GRANT_DETAILS_PAGE_ENABLED = true - SHARE_TERMINOLOGY_ENABLED = true + NEW_GRANT_DETAILS_PAGE_ENABLED = true, + SHARE_TERMINOLOGY_ENABLED = true, + SHOW_FORECASTED_GRANTS = false, } // Postgres diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index 69284a8de..44b48fbbf 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -76,6 +76,7 @@ api_log_retention_in_days = 14 api_container_environment = { NEW_GRANT_DETAILS_PAGE_ENABLED = true, SHARE_TERMINOLOGY_ENABLED = true, + SHOW_FORECASTED_GRANTS = true, } // Postgres From 117263683d14bea9dd47197733b006bd8deffef6 Mon Sep 17 00:00:00 2001 From: mari <2312138+masimons@users.noreply.github.com> Date: Mon, 30 Sep 2024 00:29:16 -0300 Subject: [PATCH 2/4] tests --- packages/server/__tests__/db/db.test.js | 73 ++++++++++++++++--- .../server/__tests__/db/seeds/fixtures.js | 42 +++++++++++ packages/server/src/db/index.js | 12 +-- 3 files changed, 111 insertions(+), 16 deletions(-) diff --git a/packages/server/__tests__/db/db.test.js b/packages/server/__tests__/db/db.test.js index 8b79f470c..15fd2f1d0 100644 --- a/packages/server/__tests__/db/db.test.js +++ b/packages/server/__tests__/db/db.test.js @@ -368,6 +368,16 @@ describe('db', () => { const result = await db.getSingleGrantDetails({ grantId, tenantId: fixtures.users.staffUser.tenant_id }); expect(result).to.be.null; }); + it('shows forecasted grants', async () => { + const grantId = '444819'; + const result = await db.getSingleGrantDetails({ grantId, tenantId: fixtures.users.staffUser.tenant_id, showForecastedGrants: true }); + expect(result.grant_id).to.eq('444819'); + }); + it('hides forecasted grants', async () => { + const grantId = '444819'; + const result = await db.getSingleGrantDetails({ grantId, tenantId: fixtures.users.staffUser.tenant_id, showForecastedGrants: false }); + expect(result).to.be.null; + }); }); context('getGrantsAssignedAgency', () => { @@ -386,6 +396,59 @@ describe('db', () => { }); }); + // context('getGrants', () => { + // it('gets forecasted grants', async () => { + // const result = await db.getGrants({ + // showForecastedGrants: true, + // }); + // const forecastedGrant = result.data.filter((grant) => grant.opportunity_status === 'forecasted'); + // expect(forecastedGrant.length).to.equal(1); + // }); + // }); + + context('getGrant', () => { + it('gets forecasted grant', async () => { + const result = await db.getGrant({ grantId: fixtures.grants.forecastedGrant.grant_id, showForecastedGrants: true }); + expect(result.grant_id).to.equal(fixtures.grants.forecastedGrant.grant_id); + }); + + it('hides forecasted grant', async () => { + const result = await db.getGrant({ grantId: fixtures.grants.forecastedGrant.grant_id, showForecastedGrants: false }); + console.log('marissasss'); + console.log(result); + expect(result).to.be.null; + }); + }); + + context('getGrantsNew', () => { + it('gets forecasted grants', async () => { + const result = await db.getGrantsNew( + {}, + { currentPage: 1, perPage: 10, isLengthAware: true }, + { orderBy: 'open_date', orderDesc: 'true' }, + fixtures.tenants.SBA.id, + fixtures.agencies.accountancy.id, + false, + true, + ); + const forecastedGrant = result.data.filter((grant) => grant.opportunity_status === 'forecasted'); + expect(forecastedGrant.length).to.equal(1); + }); + it('hides forecasted grants', async () => { + const result = await db.getGrantsNew( + { bill: 'Infrastructure Investment and Jobs Act' }, + { currentPage: 1, perPage: 10, isLengthAware: true }, + { orderBy: 'open_date', orderDesc: 'true' }, + fixtures.tenants.SBA.id, + fixtures.agencies.accountancy.id, + false, + false, + ); + const forecastedGrant = result.data.filter((grant) => grant.opportunity_status === 'forecasted'); + expect(forecastedGrant.length).to.equal(0); + }); + }); + context('getGrants with various filters', () => { /* filters: { @@ -774,16 +837,6 @@ describe('db', () => { const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy); expect(result.length).to.equal(1); }); - it('does not return forecasted grants', async () => { - const newGrant = fixtures.grants.healthAide; - newGrant.grant_id = '444817'; - newGrant.open_date = new Date('2022-06-21'); - newGrant.opportunity_status = 'forecasted'; - await knex(TABLES.grants).insert(Object.values([newGrant])); - const result = await db.getNewGrantsForAgency(fixtures.agencies.accountancy); - const forecastedGrant = result.filter((grant) => grant.grant_id === '444817'); - expect(forecastedGrant.length).to.equal(0); - }); }); context('createUser', () => { diff --git a/packages/server/__tests__/db/seeds/fixtures.js b/packages/server/__tests__/db/seeds/fixtures.js index ed2a65fee..2c755f9eb 100644 --- a/packages/server/__tests__/db/seeds/fixtures.js +++ b/packages/server/__tests__/db/seeds/fixtures.js @@ -122,6 +122,48 @@ const agencyEligibilityCodes = { }; const grants = { + forecastedGrant: { + status: 'inbox', + grant_id: '444819', + grant_number: '29-468', + agency_code: 'NSF', + award_ceiling: '6500', + cost_sharing: 'No', + title: 'Forecasted Grant', + cfda_list: '47.050', + open_date: '2100-06-21', + close_date: '2200-11-03', + notes: 'auto-inserted by script', + search_terms: '[in title/desc]+', + reviewer_name: 'none', + opportunity_category: 'Discretionary', + description: 'Grant that is forecasted', + eligibility_codes: '25', + opportunity_status: 'forecasted', + raw_body_json: { + opportunity: { + id: '444819', + number: '29-468', + title: 'Forecasted Grant', + description: 'Grant that is forecasted', + category: { name: 'Discretionary' }, + milestones: { post_date: '2100-06-21', close: { date: '2200-11-03' } }, + }, + agency: { code: 'NSF' }, + cost_sharing_or_matching_requirement: false, + cfda_numbers: ['47.050'], + eligible_applicants: [{ code: '25' }], + funding_activity: { categories: [{ code: 'ISS', name: 'Income Security and Social Services' }] }, + award: { ceiling: '6500' }, + bill: 'Infrastructure Investment and Jobs Act (IIJA)', + funding_instrument_types: [{ code: 'CA' }, { code: 'G' }, { code: 'PC' }], + }, + funding_instrument_codes: 'CA G PC', + bill: 'Infrastructure Investment and Jobs Act (IIJA)', + funding_activity_category_codes: 'ISS', + created_at: '2024-08-11 11:30:38.89828-07', + updated_at: '2024-08-11 12:30:39.531-07', + }, earFellowship: { status: 'inbox', grant_id: '335255', diff --git a/packages/server/src/db/index.js b/packages/server/src/db/index.js index ac44d0eb6..df1af67c8 100755 --- a/packages/server/src/db/index.js +++ b/packages/server/src/db/index.js @@ -349,7 +349,7 @@ async function getNewGrantsForAgency(agency) { .select(knex.raw(`${TABLES.grants}.*, count(*) OVER() AS total_grants`)) .modify(helpers.whereAgencyCriteriaMatch, agencyCriteria) .modify((qb) => { - qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') }) + qb.where({ open_date: moment().subtract(1, 'day').format('YYYY-MM-DD') }); }) .limit(3); @@ -713,7 +713,7 @@ function addCsvData(qb) { tenantId: number agencyId: number */ -async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, agencyId, toCsv, showForecastedGrants=false) { +async function getGrantsNew(filters, paginationParams, orderingParams, tenantId, agencyId, toCsv, showForecastedGrants = false) { const errors = validateSearchFilters(filters); if (errors.length > 0) { throw new Error(`Invalid filters: ${errors.join(', ')}`); @@ -847,7 +847,7 @@ async function enhanceGrantData(tenantId, data) { } async function getGrants({ - currentPage, perPage, tenantId, filters, orderBy, searchTerm, orderDesc, showForecastedGrants + currentPage, perPage, tenantId, filters, orderBy, searchTerm, orderDesc, showForecastedGrants, } = {}) { const data = await knex(TABLES.grants) .modify((queryBuilder) => { @@ -1019,8 +1019,8 @@ async function getGrant({ grantId, showForecastedGrants }) { if (!showForecastedGrants) { queryBuilder.whereNot({ opportunity_status: 'forecasted' }); } - }) - return results[0]; + }); + return results.length ? results[0] : null; } async function getSingleGrantDetails({ grantId, tenantId, showForecastedGrants }) { @@ -1031,7 +1031,7 @@ async function getSingleGrantDetails({ grantId, tenantId, showForecastedGrants } if (!showForecastedGrants) { queryBuilder.whereNot({ opportunity_status: 'forecasted' }); } - }) + }); const enhancedResults = await enhanceGrantData(tenantId, results); return enhancedResults.length ? enhancedResults[0] : null; } From 935ca6915c3ec6a8a07048fc269359b9d75aa52a Mon Sep 17 00:00:00 2001 From: mari <2312138+masimons@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:19:34 -0300 Subject: [PATCH 3/4] feat(forecasted grants): fix conditional check to compare against string and cleanups --- packages/client/src/helpers/featureFlags/index.js | 4 ---- packages/server/__tests__/db/db.test.js | 10 ---------- packages/server/src/lib/email.js | 2 +- packages/server/src/routes/grants.js | 8 ++++---- terraform/prod.tfvars | 6 +++--- terraform/staging.tfvars | 6 +++--- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/packages/client/src/helpers/featureFlags/index.js b/packages/client/src/helpers/featureFlags/index.js index 756673ded..0cb33bd8c 100644 --- a/packages/client/src/helpers/featureFlags/index.js +++ b/packages/client/src/helpers/featureFlags/index.js @@ -20,7 +20,3 @@ export function followNotesEnabled() { export function grantNotesLimit() { return parseInt(getFeatureFlags().grantNotesLimit, 10) || 4; } - -export function showForecastedGrants() { - return getFeatureFlags().showForecastedGrants === true; -} diff --git a/packages/server/__tests__/db/db.test.js b/packages/server/__tests__/db/db.test.js index 15fd2f1d0..390d0a673 100644 --- a/packages/server/__tests__/db/db.test.js +++ b/packages/server/__tests__/db/db.test.js @@ -396,16 +396,6 @@ describe('db', () => { }); }); - // context('getGrants', () => { - // it('gets forecasted grants', async () => { - // const result = await db.getGrants({ - // showForecastedGrants: true, - // }); - // const forecastedGrant = result.data.filter((grant) => grant.opportunity_status === 'forecasted'); - // expect(forecastedGrant.length).to.equal(1); - // }); - // }); - context('getGrant', () => { it('gets forecasted grant', async () => { const result = await db.getGrant({ grantId: fixtures.grants.forecastedGrant.grant_id, showForecastedGrants: true }); diff --git a/packages/server/src/lib/email.js b/packages/server/src/lib/email.js index 359284cc0..f29a0a0e0 100644 --- a/packages/server/src/lib/email.js +++ b/packages/server/src/lib/email.js @@ -423,7 +423,7 @@ async function sendGrantAssignedEmails({ grantId, agencyIds, userId }) { i. Send email */ try { - const grant = await db.getGrant({ grantId, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS }); + const grant = await db.getGrant({ grantId, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS === 'true' }); const grantDetail = await buildGrantDetail(grant, notificationType.grantAssignment); const agencies = await db.getAgenciesByIds(agencyIds); await asyncBatch( diff --git a/packages/server/src/routes/grants.js b/packages/server/src/routes/grants.js index 872212506..076c122a9 100755 --- a/packages/server/src/routes/grants.js +++ b/packages/server/src/routes/grants.js @@ -42,7 +42,7 @@ router.get('/', requireUser, async (req, res) => { }, orderBy: req.query.orderBy, orderDesc: req.query.orderDesc, - showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS, + showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS === 'true', }); res.json(grants); }); @@ -93,7 +93,7 @@ router.get('/next', requireUser, async (req, res) => { user.tenant_id, user.agency_id, false, - process.env.SHOW_FORECASTED_GRANTS, + process.env.SHOW_FORECASTED_GRANTS === 'true', ); return res.json(grants); @@ -103,7 +103,7 @@ router.get('/next', requireUser, async (req, res) => { router.get('/:grantId/grantDetails', requireUser, async (req, res) => { const { grantId } = req.params; const { user } = req.session; - const response = await db.getSingleGrantDetails({ grantId, tenantId: user.tenant_id, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS }); + const response = await db.getSingleGrantDetails({ grantId, tenantId: user.tenant_id, showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS === 'true' }); res.json(response); }); @@ -130,7 +130,7 @@ router.get('/exportCSVNew', requireUser, async (req, res) => { user.tenant_id, user.agency_id, true, - process.env.SHOW_FORECASTED_GRANTS, + process.env.SHOW_FORECASTED_GRANTS === 'true', ); // Generate CSV diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index 2d0e629d1..f7f8b0ecf 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -75,9 +75,9 @@ api_enable_saved_search_grants_digest = true api_enable_grant_digest_scheduled_task = true api_log_retention_in_days = 30 api_container_environment = { - NEW_GRANT_DETAILS_PAGE_ENABLED = true, - SHARE_TERMINOLOGY_ENABLED = true, - SHOW_FORECASTED_GRANTS = false, + NEW_GRANT_DETAILS_PAGE_ENABLED = true + SHARE_TERMINOLOGY_ENABLED = true + SHOW_FORECASTED_GRANTS = false } // Postgres diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index 44b48fbbf..592d61c22 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -74,9 +74,9 @@ api_enable_saved_search_grants_digest = true api_enable_grant_digest_scheduled_task = true api_log_retention_in_days = 14 api_container_environment = { - NEW_GRANT_DETAILS_PAGE_ENABLED = true, - SHARE_TERMINOLOGY_ENABLED = true, - SHOW_FORECASTED_GRANTS = true, + NEW_GRANT_DETAILS_PAGE_ENABLED = true + SHARE_TERMINOLOGY_ENABLED = true + SHOW_FORECASTED_GRANTS = true } // Postgres From 4a4f84fb3049b92c2e9f1a374eca639782ca8dd8 Mon Sep 17 00:00:00 2001 From: Laurie Reynolds Date: Tue, 22 Oct 2024 08:59:31 -0700 Subject: [PATCH 4/4] feat(forecasted grants): pass in forecasted grants environment variable in a couple othr places --- packages/server/src/lib/email.js | 1 + packages/server/src/routes/grants.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/server/src/lib/email.js b/packages/server/src/lib/email.js index f29a0a0e0..6776c2d83 100644 --- a/packages/server/src/lib/email.js +++ b/packages/server/src/lib/email.js @@ -517,6 +517,7 @@ async function getAndSendGrantForSavedSearch({ {}, userSavedSearch.tenantId, false, + process.env.SHOW_FORECASTED_GRANTS === 'true', ); return sendGrantDigestEmail({ diff --git a/packages/server/src/routes/grants.js b/packages/server/src/routes/grants.js index 076c122a9..97456340e 100755 --- a/packages/server/src/routes/grants.js +++ b/packages/server/src/routes/grants.js @@ -217,6 +217,7 @@ router.get('/exportCSV', requireUser, async (req, res) => { opportunityStatuses: parseCollectionQueryParam(req, 'opportunityStatuses'), opportunityCategories: parseCollectionQueryParam(req, 'opportunityCategories'), }, + showForecastedGrants: process.env.SHOW_FORECASTED_GRANTS === 'true', }); // Generate CSV