rev |
line source |
bsw/jbe@0
|
1 local areas_selector = param.get("areas_selector", "table")
|
bsw/jbe@0
|
2
|
bsw@9
|
3 areas_selector
|
bsw@9
|
4 :reset_fields()
|
bsw@9
|
5 :add_field("area.id", nil, { "grouped" })
|
bsw@9
|
6 :add_field("area.name", nil, { "grouped" })
|
bsw@9
|
7 :add_field("member_weight", nil, { "grouped" })
|
bsw@9
|
8 :add_field("direct_member_count", nil, { "grouped" })
|
bsw@9
|
9 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted ISNULL AND issue.closed ISNULL)", "issues_new_count")
|
bsw@9
|
10 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL)", "issues_discussion_count")
|
bsw@9
|
11 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL)", "issues_frozen_count")
|
bsw@9
|
12 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL)", "issues_voting_count")
|
bsw@9
|
13 :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count")
|
bsw@10
|
14 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed NOTNULL)", "issues_finished_count")
|
bsw@10
|
15 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen ISNULL AND issue.closed NOTNULL)", "issues_cancelled_count")
|
bsw@9
|
16
|
bsw/jbe@0
|
17 ui.order{
|
bsw/jbe@0
|
18 name = name,
|
bsw/jbe@0
|
19 selector = areas_selector,
|
bsw/jbe@0
|
20 options = {
|
bsw/jbe@0
|
21 {
|
bsw/jbe@0
|
22 name = "member_weight",
|
bsw/jbe@0
|
23 label = _"Population",
|
bsw/jbe@0
|
24 order_by = "area.member_weight DESC"
|
bsw/jbe@0
|
25 },
|
bsw/jbe@0
|
26 {
|
bsw/jbe@0
|
27 name = "direct_member_count",
|
bsw/jbe@0
|
28 label = _"Direct member count",
|
bsw/jbe@0
|
29 order_by = "area.direct_member_count DESC"
|
bsw/jbe@0
|
30 },
|
bsw/jbe@0
|
31 {
|
bsw/jbe@0
|
32 name = "az",
|
bsw/jbe@0
|
33 label = _"A-Z",
|
bsw/jbe@0
|
34 order_by = "area.name"
|
bsw/jbe@0
|
35 },
|
bsw/jbe@0
|
36 {
|
bsw/jbe@0
|
37 name = "za",
|
bsw/jbe@0
|
38 label = _"Z-A",
|
bsw/jbe@0
|
39 order_by = "area.name DESC"
|
bsw/jbe@0
|
40 }
|
bsw/jbe@0
|
41 },
|
bsw/jbe@0
|
42 content = function()
|
bsw/jbe@0
|
43 ui.list{
|
bsw/jbe@0
|
44 records = areas_selector:exec(),
|
bsw/jbe@0
|
45 columns = {
|
bsw/jbe@0
|
46 {
|
bsw/jbe@0
|
47 content = function(record)
|
bsw/jbe@0
|
48 if record.member_weight and record.direct_member_count then
|
bsw/jbe@0
|
49 local max_value = MemberCount:get()
|
bsw/jbe@0
|
50 ui.bargraph{
|
bsw/jbe@0
|
51 max_value = max_value,
|
bsw/jbe@4
|
52 width = 100,
|
bsw/jbe@0
|
53 bars = {
|
bsw/jbe@0
|
54 { color = "#444", value = record.direct_member_count },
|
bsw/jbe@0
|
55 { color = "#777", value = record.member_weight - record.direct_member_count },
|
bsw/jbe@0
|
56 { color = "#ddd", value = max_value - record.member_weight },
|
bsw/jbe@0
|
57 }
|
bsw/jbe@0
|
58 }
|
bsw/jbe@0
|
59 end
|
bsw/jbe@0
|
60 end
|
bsw/jbe@0
|
61 },
|
bsw/jbe@0
|
62 {
|
bsw/jbe@0
|
63 content = function(record)
|
bsw/jbe@0
|
64 ui.link{
|
bsw/jbe@0
|
65 text = record.name,
|
bsw/jbe@0
|
66 module = "area",
|
bsw/jbe@0
|
67 view = "show",
|
bsw/jbe@0
|
68 id = record.id
|
bsw/jbe@0
|
69 }
|
bsw/jbe@0
|
70 end
|
bsw@9
|
71 },
|
bsw@9
|
72 {
|
bsw@9
|
73 label = _"New",
|
bsw@9
|
74 field_attr = { style = "text-align: right;" },
|
bsw@9
|
75 content = function(record)
|
bsw@9
|
76 ui.link{
|
bsw@9
|
77 text = tostring(record.issues_new_count),
|
bsw@9
|
78 module = "area",
|
bsw@9
|
79 view = "show",
|
bsw@9
|
80 id = record.id,
|
bsw@9
|
81 params = { filter = "new" }
|
bsw@9
|
82 }
|
bsw@9
|
83 end
|
bsw@9
|
84 },
|
bsw@9
|
85 {
|
bsw@9
|
86 label = _"Discussion",
|
bsw@9
|
87 field_attr = { style = "text-align: right;" },
|
bsw@9
|
88 content = function(record)
|
bsw@9
|
89 ui.link{
|
bsw@9
|
90 text = tostring(record.issues_discussion_count),
|
bsw@9
|
91 module = "area",
|
bsw@9
|
92 view = "show",
|
bsw@9
|
93 id = record.id,
|
bsw@9
|
94 params = { filter = "accepted" }
|
bsw@9
|
95 }
|
bsw@9
|
96 end
|
bsw@9
|
97 },
|
bsw@9
|
98 {
|
bsw@9
|
99 label = _"Frozen",
|
bsw@9
|
100 field_attr = { style = "text-align: right;" },
|
bsw@9
|
101 content = function(record)
|
bsw@9
|
102 ui.link{
|
bsw@9
|
103 text = tostring(record.issues_frozen_count),
|
bsw@9
|
104 module = "area",
|
bsw@9
|
105 view = "show",
|
bsw@9
|
106 id = record.id,
|
bsw@9
|
107 params = { filter = "half_frozen" }
|
bsw@9
|
108 }
|
bsw@9
|
109 end
|
bsw@9
|
110 },
|
bsw@9
|
111 {
|
bsw@9
|
112 label = _"Voting",
|
bsw@9
|
113 field_attr = { style = "text-align: right;" },
|
bsw@9
|
114 content = function(record)
|
bsw@9
|
115 ui.link{
|
bsw@9
|
116 text = tostring(record.issues_voting_count),
|
bsw@9
|
117 module = "area",
|
bsw@9
|
118 view = "show",
|
bsw@9
|
119 id = record.id,
|
bsw@9
|
120 params = { filter = "frozen" }
|
bsw@9
|
121 }
|
bsw@9
|
122 end
|
bsw@9
|
123 },
|
bsw@9
|
124 {
|
bsw@9
|
125 label = _"Not yet voted",
|
bsw@9
|
126 field_attr = { style = "text-align: right;" },
|
bsw@9
|
127 content = function(record)
|
bsw@9
|
128 ui.link{
|
bsw@9
|
129 attr = { class = record.issues_to_vote_count > 0 and "not_voted" or nil },
|
bsw@9
|
130 text = tostring(record.issues_to_vote_count),
|
bsw@9
|
131 module = "area",
|
bsw@9
|
132 view = "show",
|
bsw@9
|
133 id = record.id,
|
bsw@9
|
134 params = { filter = "frozen", filter_voting = "not_voted" }
|
bsw@9
|
135 }
|
bsw@9
|
136 end
|
bsw@10
|
137 },
|
bsw@10
|
138 {
|
bsw@10
|
139 label = _"Finished",
|
bsw@10
|
140 field_attr = { style = "text-align: right;" },
|
bsw@10
|
141 content = function(record)
|
bsw@10
|
142 ui.link{
|
bsw@10
|
143 text = tostring(record.issues_finished_count),
|
bsw@10
|
144 module = "area",
|
bsw@10
|
145 view = "show",
|
bsw@10
|
146 id = record.id,
|
bsw@10
|
147 params = { filter = "finished", issue_list = "newest" }
|
bsw@10
|
148 }
|
bsw@10
|
149 end
|
bsw@10
|
150 },
|
bsw@10
|
151 {
|
bsw@10
|
152 label = _"Cancelled",
|
bsw@10
|
153 field_attr = { style = "text-align: right;" },
|
bsw@10
|
154 content = function(record)
|
bsw@10
|
155 ui.link{
|
bsw@10
|
156 text = tostring(record.issues_cancelled_count),
|
bsw@10
|
157 module = "area",
|
bsw@10
|
158 view = "show",
|
bsw@10
|
159 id = record.id,
|
bsw@10
|
160 params = { filter = "cancelled", issue_list = "newest" }
|
bsw@10
|
161 }
|
bsw@10
|
162 end
|
bsw@10
|
163 },
|
bsw/jbe@0
|
164 }
|
bsw/jbe@0
|
165 }
|
bsw/jbe@0
|
166 end
|
bsw/jbe@4
|
167 }
|
bsw/jbe@4
|
168
|
bsw/jbe@4
|
169 ui.bargraph_legend{
|
bsw/jbe@4
|
170 width = 25,
|
bsw/jbe@4
|
171 bars = {
|
bsw/jbe@4
|
172 { color = "#444", label = _"Direct membership" },
|
bsw/jbe@4
|
173 { color = "#777", label = _"Membership by delegation" },
|
bsw/jbe@4
|
174 { color = "#ddd", label = _"No membership at all" },
|
bsw/jbe@4
|
175 }
|
bsw/jbe@4
|
176 }
|
bsw/jbe@4
|
177
|