From 38438e8a4292dae49f92d3474ff9bd1f5ff133dd Mon Sep 17 00:00:00 2001 From: Daniel Cloud Date: Thu, 25 Mar 2021 17:29:37 -0400 Subject: [PATCH] [TTAHUB-35]: improve handling of input ids in getDownloadableActivityReports --- src/services/activityReports.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/activityReports.js b/src/services/activityReports.js index 224e70dca0..b4903c035a 100644 --- a/src/services/activityReports.js +++ b/src/services/activityReports.js @@ -597,11 +597,12 @@ export async function getDownloadableActivityReports(readRegions, { }) { const regions = readRegions || []; // Create a Set to ensure unique ordered values - const reportIds = Array.isArray(report) ? new Set(report) : new Set([report]); + const reportSet = Array.isArray(report) ? new Set(report) : new Set([report]); + const reportIds = [...reportSet].filter((i) => Number.isInteger(i)); const result = await ActivityReport.findAndCountAll( { - where: { regionId: regions, imported: null, id: { [Op.in]: [...reportIds] } }, + where: { regionId: regions, imported: null, id: { [Op.in]: reportIds } }, attributes: { include: ['displayId'], exclude: ['imported', 'legacyId'] }, include: [ {