Small fixes

This commit is contained in:
Vadim 2020-04-21 14:35:19 +03:00
parent cbf63a0b9d
commit a1bde70929
1 changed files with 11 additions and 11 deletions

View File

@ -242,14 +242,14 @@ class ContractsStore {
console.log(e.message) console.log(e.message)
} }
const [keysBallots, minTresholdBallots, proxyBallots, emissionFundsBallots] = await Promise.all([ const [keysBallots, minThresholdBallots, proxyBallots, emissionFundsBallots] = await Promise.all([
this.getBallots(keysNextBallotId, 'votingToChangeKeys'), this.getBallots(keysNextBallotId, 'votingToChangeKeys'),
this.getBallots(minThresholdNextBallotId, 'votingToChangeMinThreshold'), this.getBallots(minThresholdNextBallotId, 'votingToChangeMinThreshold'),
this.getBallots(proxyNextBallotId, 'votingToChangeProxy'), this.getBallots(proxyNextBallotId, 'votingToChangeProxy'),
this.getBallots(emissionFundsNextBallotId, 'votingToManageEmissionFunds') this.getBallots(emissionFundsNextBallotId, 'votingToManageEmissionFunds')
]) ])
const ballots = [...keysBallots, ...minTresholdBallots, ...proxyBallots, ...emissionFundsBallots] const ballots = [...keysBallots, ...minThresholdBallots, ...proxyBallots, ...emissionFundsBallots]
ballotsStore.ballotCards = this.mapBallotsToCards(ballots) ballotsStore.ballotCards = this.mapBallotsToCards(ballots)
const finalizedOrCancelled = item => item.isFinalized || item.isCanceled const finalizedOrCancelled = item => item.isFinalized || item.isCanceled
@ -257,7 +257,7 @@ class ContractsStore {
`ballots-${this.netId}`, `ballots-${this.netId}`,
JSON.stringify({ JSON.stringify({
votingToChangeKeys: keysBallots.filter(finalizedOrCancelled), votingToChangeKeys: keysBallots.filter(finalizedOrCancelled),
votingToChangeMinThreshold: minTresholdBallots.filter(finalizedOrCancelled), votingToChangeMinThreshold: minThresholdBallots.filter(finalizedOrCancelled),
votingToChangeProxy: proxyBallots.filter(finalizedOrCancelled), votingToChangeProxy: proxyBallots.filter(finalizedOrCancelled),
votingToManageEmissionFunds: emissionFundsBallots.filter(finalizedOrCancelled) votingToManageEmissionFunds: emissionFundsBallots.filter(finalizedOrCancelled)
}) })
@ -348,16 +348,16 @@ class ContractsStore {
return votingState return votingState
} }
mapBallotsToCards = cards => { mapBallotsToCards = ballots => {
return cards.map(card => { return ballots.map((ballot, pos) => {
let component let component
let params = { let params = {
id: card.id, id: ballot.id,
key: card.contractType + card.id, key: ballot.type + ballot.id,
pos: ballotsStore.ballotCards.length, pos,
votingState: card votingState: ballot
} }
switch (card.contractType) { switch (ballot.type) {
case 'votingToChangeKeys': case 'votingToChangeKeys':
component = <BallotKeysCard {...params} type={ballotStore.BallotType.keys} /> component = <BallotKeysCard {...params} type={ballotStore.BallotType.keys} />
break break
@ -382,7 +382,7 @@ class ContractsStore {
try { try {
votingState = await this[contractType].getBallotInfo(id, this.votingKey) votingState = await this[contractType].getBallotInfo(id, this.votingKey)
votingState = this.fillCardVotingState(votingState, contractType) votingState = this.fillCardVotingState(votingState, contractType)
votingState.contractType = contractType votingState.type = contractType
votingState.id = id votingState.id = id
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)