Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show 'blocks left for voting' instead of percentage. #226

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions agenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ func (a *Agenda) VotePercent(voteID string) float64 {
return toFixed(percent*100, 2)
}

// VoteCountPercentage returns the number of votes cast against this agenda as
// VoteCountPercentage returns the number of yes/no/abstain votes cast against this agenda as
// a percentage of the theoretical maximum number of possible votes
func (a *Agenda) VoteCountPercentage() float64 {
func (a *Agenda) VoteCountPercentage(voteID string) float64 {
maxPossibleVotes := float64(activeNetParams.RuleChangeActivationInterval) * float64(activeNetParams.TicketsPerBlock)
voteCountPercentage := float64(a.TotalVotes()) / maxPossibleVotes
voteCountPercentage := float64(a.VoteCounts[voteID]) / maxPossibleVotes
return toFixed(voteCountPercentage*100, 1)
}

Expand Down
19 changes: 12 additions & 7 deletions public/css/decred-hardforkwebsite.css
Original file line number Diff line number Diff line change
Expand Up @@ -1648,17 +1648,22 @@ body {
line-height: 17px;
}

.heading.progress-bar-agenda-voting-percent {
.heading.blocks-left-for-voting {
position: absolute;
display: flex;
align-items: center;
top: 0px;
right: 0px;
width: 75px;
background-image: url('../images/voting-percent-diamond.svg');
background-position: 0px 50%;
background-repeat: no-repeat;
color: #0c1e3e;
line-height: 17px;
text-align: right;
padding-bottom: 10px;
}

.blocks-left-for-voting-dot {
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 5px;
background-color: #5a6d81;
}

.heading.voting-overview {
Expand Down
7 changes: 0 additions & 7 deletions public/images/voting-percent-diamond.svg

This file was deleted.

9 changes: 6 additions & 3 deletions public/views/start.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{{if or $agenda.IsStarted $agenda.IsActive $agenda.IsLockedIn $agenda.IsFailed }}
{{range $cid, $choice := $agenda.VoteChoices}}
.option-progress.a_{{$agenda.ID}}-c{{$choice.ID}} {
width: {{roundDown ($agenda.VotePercent $choice.ID)}}%;
width: {{roundDown ($agenda.VoteCountPercentage $choice.ID)}}%;
}
{{end}}
{{end}}
Expand Down Expand Up @@ -393,7 +393,7 @@
</div>

<!-- agenda voting results barchart -->
{{if not $agenda.IsDefined }}
{{if $agenda.IsStarted }}
<div class="agenda-section progress-bar w-clearfix">
<div class="progress-bar-agenda w-clearfix">
<div class="progress-bar-competing-options-and-total-votes w-clearfix">
Expand All @@ -407,7 +407,10 @@
</div>
{{end}}
</div>
<div class="heading progress-bar-agenda-voting-percent">{{$agenda.VoteCountPercentage }}%</div>
<div class="heading blocks-left-for-voting">
<div class="blocks-left-for-voting-dot"></div>
{{minus64 $agenda.EndHeight $.BlockHeight}} blocks left for voting
</div>
</div>
</div>
{{end}}
Expand Down