fix off by 1 error in fetching pledge delegates

This commit is contained in:
Barry Gitarts 2019-06-07 10:43:31 -04:00 committed by Barry G
parent 1dbe012357
commit 31b2dd0697
1 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@ const getPledgeDelegates = (idPledge, numDelegates) => {
const delegates = [] const delegates = []
const num = Number(numDelegates) const num = Number(numDelegates)
if (!num) return delegates if (!num) return delegates
for (let i = 1; i <= num; i++) { for (let i = 1; i < num; i++) {
delegates.push(getPledgeDelegate(idPledge, i).call()) delegates.push(getPledgeDelegate(idPledge, i).call())
} }
return Promise.all(delegates) return Promise.all(delegates)
@ -30,7 +30,8 @@ export const getAllPledges = async (start = 1) => {
const numPledges = await LiquidPledging.methods.numberOfPledges().call() const numPledges = await LiquidPledging.methods.numberOfPledges().call()
const pledges = [] const pledges = []
for (let i = start; i <= numPledges; i++) { for (let i = start; i <= numPledges; i++) {
pledges.push(getPledge(i).call()) const pledge = getPledge(i).call()
pledges.push(pledge)
} }
return Promise.all(pledges.map(formatPledge)) return Promise.all(pledges.map(formatPledge))
} }