From 81e2050731aec41ba1c89bf56d2b2e15d8f2285f Mon Sep 17 00:00:00 2001 From: Daniel Cloud Date: Thu, 25 Mar 2021 10:46:06 -0400 Subject: [PATCH] [TTAHUB-35]: Remove manual ordering, order by report id. --- src/services/activityReports.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/services/activityReports.js b/src/services/activityReports.js index 44eead5b87..224e70dca0 100644 --- a/src/services/activityReports.js +++ b/src/services/activityReports.js @@ -687,16 +687,8 @@ export async function getDownloadableActivityReports(readRegions, { }, ], distinct: true, + order: [['id', 'DESC']], }, ); - // Hack together manual sort until we can figure out how to do custom SQL - const sortedRows = []; - reportIds.forEach((id) => { - const match = result.rows.find((el) => el.id.toString() === id); - if (match) { - sortedRows.push(match); - } - }); - result.rows = sortedRows; return result; }