@poprank/rankings
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -51,4 +51,4 @@ "use strict"; | ||
nfts.forEach(function (nft) { | ||
nft.traits.forEach(function (n) { | ||
pushTraitToCollectionTraits(collectionTraitsNoRarity, n); | ||
nft.traits.forEach(function (t) { | ||
pushTraitToCollectionTraits(collectionTraitsNoRarity, t); | ||
}); | ||
@@ -121,11 +121,12 @@ }); | ||
var trait = (_a = traitValuesOfThisType.find(function (t) { return t.typeValue === traitType; })) !== null && _a !== void 0 ? _a : traitValuesOfThisType.find(function (t) { return t.category === 'None'; }); | ||
if (trait.value === 'none') | ||
// Temporarily disable this ahead of reworking our trait calculation | ||
if (trait.category === 'None') | ||
return; | ||
var currTraitValue = trait.value; | ||
var value = trait.value, typeValue = trait.typeValue; | ||
var currTraitValueCount = trait.traitCount; | ||
var collectionTraitValueCountPairs = collectionTraitsNoRarity[trait.typeValue]; | ||
var collectionTraitValueCountPairs = collectionTraitsNoRarity[typeValue]; | ||
var traitTypeCount = collectionTraitValueCountPairs.length; | ||
var currTraitRarity = (0, exports.traitRarityTraitSum)(currTraitValueCount, nfts.length, traitTypeCount); | ||
var currTraitSum = 0; | ||
if (trait.typeValue === rarity_meta_1.TRAIT_COUNT) { | ||
if (typeValue === rarity_meta_1.TRAIT_COUNT) { | ||
currTraitSum = currTraitRarity * (maxTraitsNum - nft.traits.length); | ||
@@ -137,4 +138,6 @@ } | ||
currTraitSum = +currTraitSum.toFixed(3); | ||
if (!collectionTraits[trait.typeValue].find(function (t) { return t.value === currTraitValue; })) | ||
collectionTraits[trait.typeValue].push((__assign(__assign({}, trait), { traitCount: currTraitValueCount, rarityTraitSum: currTraitSum }))); | ||
if (!collectionTraits[typeValue]) | ||
collectionTraits[typeValue] = []; | ||
if (!collectionTraits[typeValue].find(function (t) { return t.value === value; })) | ||
collectionTraits[typeValue].push((__assign(__assign({}, trait), { traitCount: currTraitValueCount, rarityTraitSum: currTraitSum }))); | ||
rarityTraitSum += currTraitSum; | ||
@@ -141,0 +144,0 @@ nftTraitsWithRarity.push(__assign(__assign({}, trait), { traitCount: 1, rarityTraitSum: currTraitSum })); |
{ | ||
"name": "@poprank/rankings", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
32375
430