Don't include isWinner in active cap (#5668)

This commit is contained in:
Jaco 2021-06-23 13:21:21 +03:00 committed by GitHub
parent 810967392c
commit ae75e687a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,9 +84,9 @@ function sortCampaigns (a: Campaign, b: Campaign): number {
// compare the current campaigns against the previous, manually adding ending and calculating the new totals
function createResult (bestNumber: BlockNumber, minContribution: BN, funds: Campaign[], leased: ParaId[], prev: Campaigns): Campaigns {
const [activeRaised, activeCap, totalRaised, totalCap] = funds.reduce(([ar, ac, tr, tc], { info: { cap, end, raised } }) => [
bestNumber.gt(end) ? ar : ar.iadd(raised),
bestNumber.gt(end) ? ac : ac.iadd(cap),
const [activeRaised, activeCap, totalRaised, totalCap] = funds.reduce(([ar, ac, tr, tc], { info: { cap, end, raised }, isWinner }) => [
(bestNumber.gt(end) || isWinner) ? ar : ar.iadd(raised),
(bestNumber.gt(end) || isWinner) ? ac : ac.iadd(cap),
tr.iadd(raised),
tc.iadd(cap)
], [new BN(0), new BN(0), new BN(0), new BN(0)]);