parent
42421e58de
commit
240a6f9fd3
|
@ -120,7 +120,8 @@ proc renderPoll(poll: Poll): VNode =
|
||||||
for i in 0 ..< poll.options.len:
|
for i in 0 ..< poll.options.len:
|
||||||
let
|
let
|
||||||
leader = if poll.leader == i: " leader" else: ""
|
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={'.'}) & '%'
|
percStr = (&"{perc:>3.0f}").strip(chars={'.'}) & '%'
|
||||||
tdiv(class=("poll-meter" & leader)):
|
tdiv(class=("poll-meter" & leader)):
|
||||||
span(class="poll-choice-bar", style={width: percStr})
|
span(class="poll-choice-bar", style={width: percStr})
|
||||||
|
|
Loading…
Reference in New Issue