[frontend/components] Fix vote percentage calculations
This commit is contained in:
parent
e091eb01e9
commit
9dd04f3035
1 changed files with 3 additions and 3 deletions
|
@ -34,11 +34,11 @@
|
||||||
@{ var total = Poll.Choices.Sum(p => p.Votes); }
|
@{ var total = Poll.Choices.Sum(p => p.Votes); }
|
||||||
@foreach (var choice in Poll.Choices)
|
@foreach (var choice in Poll.Choices)
|
||||||
{
|
{
|
||||||
<span class="poll-result @(choice.Voted ? "voted" : "")" style="--percentage: @(choice.Votes / total * 100)%;">
|
<span class="poll-result @(choice.Voted ? "voted" : "")" style="--percentage: @(choice.Votes / (double)total * 100)%;">
|
||||||
<span class="poll-value">
|
<span class="poll-value">
|
||||||
<MfmText Text="@choice.Value" Emoji="@Emoji" Simple="true"/>
|
<MfmText Text="@choice.Value" Emoji="@Emoji" Simple="true"/>
|
||||||
</span>
|
</span>
|
||||||
<span class="poll-info"><span class="vote-count">@Loc["{0} votes", choice.Votes]</span><span class="vote-percentage">@(choice.Votes / total * 100)%</span></span>
|
<span class="poll-info"><span class="vote-count">@Loc["{0} votes", choice.Votes]</span><span class="vote-percentage">@(choice.Votes / (double)total * 100)%</span></span>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue