Skip to content

Commit

Permalink
match voting result value with homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris committed Dec 6, 2018
1 parent 2f81ac7 commit 0709058
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/renderer/components/wallet-detail/ProposalListItemDetail.vue
Expand Up @@ -34,6 +34,10 @@
<span class="label">{{$t('abstain')}}</span>
<span class="votes">{{item.result_abs.toLocaleString()}} ({{votesPercentage(item.result_abs)}}%)</span>
</div>
<div class="undecided">
<span class="label">{{$t('undecided')}}</span>
<span class="votes">{{undecidedCount.toLocaleString()}} ({{votesPercentage(undecidedCount)}}%)</span>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -118,10 +122,10 @@
this.voted = await this.$store.getters.hasVotedForProposal(this.item.id, this.wallet.address);
},
votesPercentage(v) {
if (!this.totalVoteCount) {
if (!this.item.result_count) {
return 0;
}
return ((parseInt(v, 10) / this.totalVoteCount) * 100).toFixed(1);
return ((parseInt(v, 10) / parseInt(this.item.result_count, 10)) * 100).toFixed(2);
},
},
computed: {
Expand Down Expand Up @@ -201,6 +205,9 @@
parseInt(this.item.result_no, 10) +
parseInt(this.item.result_abs, 10);
},
undecidedCount() {
return this.item.result_count - this.totalVoteCount;
},
},
mounted() {
this.$store.state.App.ga.send('screenview', { cd: 'bos-wallet-proposal-item-detail' });
Expand All @@ -218,11 +225,13 @@
['agree', this.item.result_yes],
['disagree', this.item.result_no],
['abstain', this.item.result_abs],
['undecided', this.undecidedCount],
],
colors: {
agree: '#1792f0',
disagree: '#ed6060',
abstain: '#728395',
abstain: '#5BD76A',
undecided: '#CDD8E5',
},
type: 'donut',
},
Expand Down Expand Up @@ -461,6 +470,7 @@
.ProposalListItemDetail .chart .counts .agree {
color: #1792f0;
margin-top: -20px;
margin-bottom: 5px;
}
Expand All @@ -471,7 +481,13 @@
}
.ProposalListItemDetail .chart .counts .abstain {
color: #728395;
color: #3DC04C;
margin-top: 5px;
margin-bottom: 5px;
}
.ProposalListItemDetail .chart .counts .undecided {
color: #7C92AE;
margin-top: 5px;
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/en.json
Expand Up @@ -114,6 +114,7 @@
"agree": "Agree",
"disagree": "Disagree",
"abstain": "Abstain",
"undecided": "Undecided",
"change my vote": "Change the vote",
"there is no ongoing congress voting": "There is no ongoing Congress Voting now",
"there is no closed congress voting": "There is no past proposals",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/ko.json
Expand Up @@ -114,6 +114,7 @@
"agree": "찬성",
"disagree": "반대",
"abstain": "기권",
"undecided": "미참여",
"change my vote": "투표 수정",
"there is no ongoing congress voting": "진행중인 투표가 없습니다",
"there is no closed congress voting": "종료된 투표가 없습니다",
Expand Down

0 comments on commit 0709058

Please sign in to comment.