From 95605850350820e35f7366eb1f4d177fa14bb593 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 18 Jul 2017 16:50:30 -0700 Subject: [PATCH] fixed sort to show lower height first --- controllers/serveController.js | 2 +- helpers/libraries/serveHelpers.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/serveController.js b/controllers/serveController.js index 2a5c34a5..847109ec 100644 --- a/controllers/serveController.js +++ b/controllers/serveController.js @@ -203,7 +203,7 @@ module.exports = { .then(result => { // 3. if a match is found locally, serve that claim if (result) { - logger.debug('Result found in File table:', result.dataValues); + logger.debug('Result found in File table'); // return the data for the file to be served resolve(result.dataValues); // update the file, as needed diff --git a/helpers/libraries/serveHelpers.js b/helpers/libraries/serveHelpers.js index 656a0750..e5398785 100644 --- a/helpers/libraries/serveHelpers.js +++ b/helpers/libraries/serveHelpers.js @@ -42,6 +42,7 @@ module.exports = { getClaimsList(name) .then(({ claims }) => { const regex = new RegExp(`^${claimId}`); + logger.debug('regex:', regex); const filteredClaimsList = claims.filter(claim => { return regex.test(claim.claim_id); }); @@ -55,7 +56,7 @@ module.exports = { break; default: const sortedClaimsList = filteredClaimsList.sort((a, b) => { - return a.height < b.height; + return a.height > b.height; }); resolve(sortedClaimsList[0].claim_id); break;