liquid_feedback_frontend

view app/main/suggestion/_collective_rating.lua @ 1858:3d1f0464a3ea

Handle missing ldap.member.allowed function
author bsw
date Tue Sep 20 17:35:29 2022 +0200 (20 months ago)
parents 4188405c2425
children
line source
1 local suggestion = param.get("suggestion", "table")
3 local plus2 = (suggestion.plus2_unfulfilled_count or 0)
4 + (suggestion.plus2_fulfilled_count or 0)
5 local plus1 = (suggestion.plus1_unfulfilled_count or 0)
6 local minus1 = (suggestion.minus1_unfulfilled_count or 0)
7 + (suggestion.minus1_fulfilled_count or 0)
8 local minus2 = (suggestion.minus2_unfulfilled_count or 0)
9 + (suggestion.minus2_fulfilled_count or 0)
11 local with_opinion = plus2 + plus1 + minus1 + minus2
13 local neutral = (suggestion.initiative.supporter_count or 0)
14 - with_opinion
16 local neutral2 = with_opinion
17 - (suggestion.plus2_fulfilled_count or 0)
18 - (suggestion.plus1_fulfilled_count or 0)
19 - (suggestion.minus1_fulfilled_count or 0)
20 - (suggestion.minus2_fulfilled_count or 0)
23 if with_opinion > 0 then
24 ui.container { attr = { class = "suggestion-rating" }, content = function ()
25 ui.tag { content = _"collective rating:" }
26 slot.put(" ")
27 ui.bargraph{
28 max_value = suggestion.initiative.supporter_count,
29 width = 100,
30 bars = {
31 { color = "#0a0", value = plus2 },
32 { color = "#8a8", value = plus1 },
33 { color = "#eee", value = neutral },
34 { color = "#a88", value = minus1 },
35 { color = "#a00", value = minus2 },
36 }
37 }
38 slot.put(" | ")
39 ui.tag { content = _"implemented:" }
40 slot.put ( " " )
41 ui.bargraph{
42 max_value = with_opinion,
43 width = 100,
44 bars = {
45 { color = "#0a0", value = suggestion.plus2_fulfilled_count },
46 { color = "#8a8", value = suggestion.plus1_fulfilled_count },
47 { color = "#eee", value = neutral2 },
48 { color = "#a88", value = suggestion.minus1_fulfilled_count },
49 { color = "#a00", value = suggestion.minus2_fulfilled_count },
50 }
51 }
52 end }
53 end

Impressum / About Us