liquid_feedback_frontend
diff app/main/initiative/_sidebar_state.lua @ 1210:7e48d429389f
Unified rendering of vote percentages (floor instead of round)
author | bsw |
---|---|
date | Sat Jul 18 16:46:55 2015 +0200 (2015-07-18) |
parents | 9817055e792b |
children | 32cc544d5a5b |
line diff
1.1 --- a/app/main/initiative/_sidebar_state.lua Sat Jul 18 16:20:30 2015 +0200 1.2 +++ b/app/main/initiative/_sidebar_state.lua Sat Jul 18 16:46:55 2015 +0200 1.3 @@ -14,10 +14,6 @@ 1.4 local abstention_votes = max_value - 1.5 negative_votes - 1.6 positive_votes 1.7 - local function perc(votes, sum) 1.8 - if sum > 0 then return string.format( "%.f", votes * 100 / sum ) .. "%" end 1.9 - return "" 1.10 - end 1.11 local head_text 1.12 if initiative.winner then 1.13 head_text = _"Approved" 1.14 @@ -38,7 +34,7 @@ 1.15 } 1.16 ui.tag { tag = "th", content = _"Yes" } 1.17 ui.tag { tag = "td", content = 1.18 - perc(positive_votes, max_value) 1.19 + format.percent_floor(positive_votes, max_value) 1.20 } 1.21 ui.tag { tag = "th", content = _"Yes" } 1.22 end } 1.23 @@ -48,7 +44,7 @@ 1.24 } 1.25 ui.tag { tag = "th", content = _"Abstention" } 1.26 ui.tag { tag = "td", content = 1.27 - perc(abstention_votes, max_value) 1.28 + format.percent_floor(abstention_votes, max_value) 1.29 } 1.30 ui.tag { tag = "th", content = _"Abstention" } 1.31 end } 1.32 @@ -58,7 +54,7 @@ 1.33 } 1.34 ui.tag { tag = "th", content = _"No" } 1.35 ui.tag { tag = "td", content = 1.36 - perc(negative_votes, max_value) 1.37 + format.percent_floor(negative_votes, max_value) 1.38 } 1.39 ui.tag { tag = "th", content = _"No" } 1.40 end }