fixed claim list sorting algo
This commit is contained in:
parent
7eaf82100e
commit
04f1406c73
1 changed files with 6 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
const isFreePublicClaim = require('./isFreePublicClaim.js');
|
const isFreePublicClaim = require('./isFreePublicClaim.js');
|
||||||
const lbryApi = require('../libraries/lbryApi.js');
|
const lbryApi = require('../libraries/lbryApi.js');
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
function filterForFreePublicClaims (claimsListArray) {
|
function filterForFreePublicClaims (claimsListArray) {
|
||||||
// console.log("claims list:", claimsListArray)
|
|
||||||
if (!claimsListArray) {
|
if (!claimsListArray) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,12 @@ function filterForFreePublicClaims (claimsListArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function orderTopClaims (claimsListArray) {
|
function orderTopClaims (claimsListArray) {
|
||||||
console.log('>> orderTopClaims');
|
logger.silly('ordering the top claims');
|
||||||
claimsListArray.sort(({ amountA, heightA }, { amountB, heightB }) => {
|
claimsListArray.sort((a, b) => {
|
||||||
if (amountA === amountB) {
|
if (a.amount === b.amount) {
|
||||||
return heightA > heightB;
|
return a.height < b.height;
|
||||||
} else {
|
} else {
|
||||||
return amountA < amountB;
|
return a.amount < b.amount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return claimsListArray;
|
return claimsListArray;
|
||||||
|
|
Loading…
Reference in a new issue