liquid_feedback_frontend
view app/main/initiative/_details.lua @ 167:1fdf1e607494
fix vote count display in corner cases
if number of voters are 0 or votes are 0 don't show percentes they are useless or -nan :-)
if number of voters are 0 or votes are 0 don't show percentes they are useless or -nan :-)
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Sat Oct 09 21:34:25 2010 +0200 (2010-10-09) |
parents | 5d797c6706d5 |
children | db91c2005278 |
line source
1 local initiative = param.get("initiative", "table")
3 ui.form{
4 attr = { class = "vertical" },
5 record = initiative,
6 readonly = true,
7 content = function()
8 local policy = initiative.issue.policy
9 ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name }
10 ui.field.text{
11 label = _"Created at",
12 value = tostring(initiative.created)
13 }
14 if initiative.revoked then
15 ui.field.text{
16 label = _"Revoked at",
17 value = format.timestamp(initiative.revoked)
18 }
19 end
20 ui.field.text{
21 label = _"Initiative quorum",
22 value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den)
23 }
24 ui.field.text{
25 label = _"Currently required",
26 value = math.ceil(initiative.issue.population * (policy.initiative_quorum_num / policy.initiative_quorum_den)),
27 }
28 -- ui.field.date{ label = _"Revoked at", name = "revoked" }
29 ui.field.boolean{ label = _"Admitted", name = "admitted" }
30 end
31 }