parent
42421e58de
commit
240a6f9fd3
1 changed files with 2 additions and 1 deletions
|
@ -120,7 +120,8 @@ proc renderPoll(poll: Poll): VNode =
|
|||
for i in 0 ..< poll.options.len:
|
||||
let
|
||||
leader = if poll.leader == i: " leader" else: ""
|
||||
perc = poll.values[i] / poll.votes * 100
|
||||
val = poll.values[i]
|
||||
perc = if val > 0: val / poll.votes * 100 else: 0
|
||||
percStr = (&"{perc:>3.0f}").strip(chars={'.'}) & '%'
|
||||
tdiv(class=("poll-meter" & leader)):
|
||||
span(class="poll-choice-bar", style={width: percStr})
|
||||
|
|
Loading…
Reference in a new issue