gw2e-account-statistics 3.19.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/statistics/unlocks.js +12 -1
- package/package.json +1 -1
- package/tests/unlocks.spec.js +6 -0
|
@@ -39,7 +39,8 @@ exports.default = function (accountData, extraInformation) {
|
|
|
39
39
|
aureneLegendaryVariantSkins: aureneLegendaryVariantSkins(accountData),
|
|
40
40
|
suffusedObsidianArmorSkins: suffusedObsidianArmorSkins(accountData),
|
|
41
41
|
coloredTitleCount: coloredTitleCount(accountData),
|
|
42
|
-
homesteadDecorationCount: homesteadDecorationCount(accountData)
|
|
42
|
+
homesteadDecorationCount: homesteadDecorationCount(accountData),
|
|
43
|
+
homesteadDecorationCountUnique: homesteadDecorationCountUnique(accountData)
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -408,4 +409,14 @@ function homesteadDecorationCount(accountData) {
|
|
|
408
409
|
return accountData.homestead.decorations.reduce(function (sum, decoration) {
|
|
409
410
|
return sum + decoration.count;
|
|
410
411
|
}, 0);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function homesteadDecorationCountUnique(accountData) {
|
|
415
|
+
if (!accountData.homestead || !accountData.homestead.decorations) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return accountData.homestead.decorations.filter(function (d) {
|
|
420
|
+
return d.count > 0;
|
|
421
|
+
}).length;
|
|
411
422
|
}
|
package/package.json
CHANGED
package/tests/unlocks.spec.js
CHANGED
|
@@ -282,4 +282,10 @@ describe('statistics > unlocks', () => {
|
|
|
282
282
|
expect(unlocksStatistics({ homestead: { decorations: [] } }, EXTRA_INFO).homesteadDecorationCount).to.equal(0)
|
|
283
283
|
expect(unlocksStatistics({ homestead: { decorations: [{ id: 1, count: 1 }, { id: 2, count: 2 }] } }, EXTRA_INFO).homesteadDecorationCount).to.equal(3)
|
|
284
284
|
})
|
|
285
|
+
|
|
286
|
+
it('can calculate homestead decoration count uniquely', () => {
|
|
287
|
+
expect(unlocksStatistics({}, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(null)
|
|
288
|
+
expect(unlocksStatistics({ homestead: { decorations: [] } }, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(0)
|
|
289
|
+
expect(unlocksStatistics({ homestead: { decorations: [{ id: 1, count: 1 }, { id: 2, count: 2 }] } }, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(2)
|
|
290
|
+
})
|
|
285
291
|
})
|