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 => {
|
.then(result => {
|
||||||
// 3. if a match is found locally, serve that claim
|
// 3. if a match is found locally, serve that claim
|
||||||
if (result) {
|
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
|
// return the data for the file to be served
|
||||||
resolve(result.dataValues);
|
resolve(result.dataValues);
|
||||||
// update the file, as needed
|
// update the file, as needed
|
||||||
|
|
|
@ -42,6 +42,7 @@ module.exports = {
|
||||||
getClaimsList(name)
|
getClaimsList(name)
|
||||||
.then(({ claims }) => {
|
.then(({ claims }) => {
|
||||||
const regex = new RegExp(`^${claimId}`);
|
const regex = new RegExp(`^${claimId}`);
|
||||||
|
logger.debug('regex:', regex);
|
||||||
const filteredClaimsList = claims.filter(claim => {
|
const filteredClaimsList = claims.filter(claim => {
|
||||||
return regex.test(claim.claim_id);
|
return regex.test(claim.claim_id);
|
||||||
});
|
});
|
||||||
|
@ -55,7 +56,7 @@ module.exports = {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
const sortedClaimsList = filteredClaimsList.sort((a, b) => {
|
const sortedClaimsList = filteredClaimsList.sort((a, b) => {
|
||||||
return a.height < b.height;
|
return a.height > b.height;
|
||||||
});
|
});
|
||||||
resolve(sortedClaimsList[0].claim_id);
|
resolve(sortedClaimsList[0].claim_id);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue