fixed sort to show lower height first
This commit is contained in:
parent
de379beec9
commit
9560585035
2 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue