Skip to content

Commit

Permalink
Merge pull request #219 from MickWang/master
Browse files Browse the repository at this point in the history
update vote records weight
  • Loading branch information
MickWang authored Jan 21, 2020
2 parents dce3d7c + 537dcdb commit 741aece
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/renderer/components/Node/Vote/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
v-if="!isVoter">
<a-icon type="caret-down"
class="icon-reject" />
<span class="total-voted">{{vote.approves}}</span>
<span class="total-voted">{{vote.rejects}}</span>
<span class="text-smal">votes</span>
</div>

Expand Down
8 changes: 5 additions & 3 deletions src/renderer/store/modules/Vote.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const actions = {
return;
},

async getVotedRecords({ commit, state }, { hash }) {
async getVotedRecords({ commit, dispatch, state }, { hash }) {
const net = localStorage.getItem('net');
const client = getRestClient()
const contract = new Crypto.Address(utils.reverseHex(contract_hash[net]))
Expand All @@ -397,10 +397,12 @@ const actions = {
isApproval: formatNumber(i[1]) === 1 ? true : false
}
})
const voters = await dispatch('getVoters', {hash})
for (let item of records) {
for (let voter of state.all_voters) {
for (let voter of voters) {
if (voter.address === item.address) {
item.name = voter.name
const voter_with_name = state.all_voters.find(item => item.address === voter.address)
item.name = voter_with_name ? voter_with_name.name : ''
item.weight = voter.weight
}
}
Expand Down

0 comments on commit 741aece

Please sign in to comment.