fixed sort to show lower height first

This commit is contained in:
bill bittner 2017-07-18 16:50:30 -07:00
parent de379beec9
commit 9560585035
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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;