Skip to content

Commit

Permalink
[TTAHUB-35]: improve handling of input ids in getDownloadableActivity…
Browse files Browse the repository at this point in the history
…Reports
  • Loading branch information
dcloud committed Mar 25, 2021
1 parent bfbf266 commit 38438e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/activityReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down

0 comments on commit 38438e8

Please sign in to comment.