rev |
line source |
bsw/jbe@19
|
1 local initiative = param.get("initiative", "table")
|
bsw/jbe@19
|
2
|
bsw/jbe@19
|
3 if initiative.revoked then
|
bsw/jbe@19
|
4 slot.put(_"Not voted (revoked from initiator)")
|
bsw/jbe@19
|
5 elseif initiative.admitted == false then
|
bsw/jbe@19
|
6 slot.put(_"Not voted (not admitted)")
|
bsw/jbe@19
|
7 else
|
bsw/jbe@19
|
8
|
bsw@31
|
9 execute.view{
|
bsw@31
|
10 module = "initiative",
|
bsw@31
|
11 view = "_battles",
|
bsw@31
|
12 params = { initiative = initiative }
|
bsw@31
|
13 }
|
bsw/jbe@19
|
14
|
bsw@286
|
15 slot.put("<br />")
|
bsw@286
|
16
|
bsw/jbe@19
|
17 ui.container{
|
bsw/jbe@19
|
18 attr = { class = "heading" },
|
bsw/jbe@19
|
19 content = _"Member voting"
|
bsw/jbe@19
|
20 }
|
bsw/jbe@19
|
21
|
bsw/jbe@19
|
22 execute.view{
|
bsw/jbe@19
|
23 module = "member",
|
bsw/jbe@19
|
24 view = "_list",
|
bsw/jbe@19
|
25 params = {
|
bsw/jbe@19
|
26 initiative = initiative,
|
bsw@190
|
27 for_votes = true,
|
bsw/jbe@19
|
28 members_selector = initiative.issue:get_reference_selector("direct_voters")
|
bsw/jbe@19
|
29 :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id })
|
bsw/jbe@19
|
30 :add_field("direct_voter.weight as voter_weight")
|
bsw/jbe@19
|
31 :add_field("coalesce(vote.grade, 0) as grade")
|
bsw@190
|
32 :join("initiative", nil, "initiative.id = vote.initiative_id")
|
bsw@190
|
33 :join("issue", nil, "issue.id = initiative.issue_id")
|
bsw/jbe@19
|
34 }
|
bsw/jbe@19
|
35 }
|
bsw/jbe@19
|
36
|
bsw@286
|
37 slot.put("<br />")
|
bsw@286
|
38
|
bsw@286
|
39 ui.container{
|
bsw@286
|
40 attr = { class = "heading" },
|
bsw@286
|
41 content = _"Voting details"
|
bsw@286
|
42 }
|
bsw@286
|
43
|
bsw@286
|
44 ui.form{
|
bsw@286
|
45 attr = { class = "vertical" },
|
bsw@286
|
46 content = function()
|
bsw@286
|
47
|
bsw@286
|
48 ui.field.boolean{ label = _"Direct majority", value = initiative.direct_majority }
|
bsw@286
|
49 ui.field.boolean{ label = _"Indirect majority", value = initiative.indirect_majority }
|
bsw@286
|
50 ui.field.text{ label = _"Schulze rank", value = tostring(initiative.schulze_rank) .. " (" .. _("Status quo: #{rank}", { rank = initiative.issue.status_quo_schulze_rank }) .. ")" }
|
bsw@286
|
51 local texts = {}
|
bsw@286
|
52 if initiative.reverse_beat_path then
|
bsw@286
|
53 texts[#texts+1] = _"reverse beat path to status quo (including ties)"
|
bsw@286
|
54 end
|
bsw@286
|
55 if initiative.multistage_majority then
|
bsw@286
|
56 texts[#texts+1] = _"possibly instable result caused by multistage majority"
|
bsw@286
|
57 end
|
bsw@286
|
58 if #texts == 0 then
|
bsw@286
|
59 texts[#texts+1] = _"none"
|
bsw@286
|
60 end
|
bsw@286
|
61 ui.field.text{
|
bsw@286
|
62 label = _"Other failures",
|
bsw@286
|
63 value = table.concat(texts, ", ")
|
bsw@286
|
64 }
|
bsw@286
|
65 ui.field.boolean{ label = _"Eligible as winner", value = initiative.eligible }
|
bsw@286
|
66 end
|
bsw@286
|
67 }
|
bsw@286
|
68
|
bsw@286
|
69
|
bsw/jbe@19
|
70 end
|