bsw@1649: local suggestion = param.get("suggestion", "table") bsw@1649: bsw@1649: local plus2 = (suggestion.plus2_unfulfilled_count or 0) bsw@1649: + (suggestion.plus2_fulfilled_count or 0) bsw@1649: local plus1 = (suggestion.plus1_unfulfilled_count or 0) bsw@1649: local minus1 = (suggestion.minus1_unfulfilled_count or 0) bsw@1649: + (suggestion.minus1_fulfilled_count or 0) bsw@1649: local minus2 = (suggestion.minus2_unfulfilled_count or 0) bsw@1649: + (suggestion.minus2_fulfilled_count or 0) bsw@1649: bsw@1649: local with_opinion = plus2 + plus1 + minus1 + minus2 bsw@1649: bsw@1649: local neutral = (suggestion.initiative.supporter_count or 0) bsw@1649: - with_opinion bsw@1649: bsw@1649: local neutral2 = with_opinion bsw@1649: - (suggestion.plus2_fulfilled_count or 0) bsw@1649: - (suggestion.plus1_fulfilled_count or 0) bsw@1649: - (suggestion.minus1_fulfilled_count or 0) bsw@1649: - (suggestion.minus2_fulfilled_count or 0) bsw@1649: bsw@1649: bsw@1649: if with_opinion > 0 then bsw@1649: ui.container { attr = { class = "suggestion-rating" }, content = function () bsw@1649: ui.tag { content = _"collective rating:" } bsw@1649: slot.put(" ") bsw@1649: ui.bargraph{ bsw@1649: max_value = suggestion.initiative.supporter_count, bsw@1649: width = 100, bsw@1649: bars = { bsw@1649: { color = "#0a0", value = plus2 }, bsw@1649: { color = "#8a8", value = plus1 }, bsw@1649: { color = "#eee", value = neutral }, bsw@1649: { color = "#a88", value = minus1 }, bsw@1649: { color = "#a00", value = minus2 }, bsw@1649: } bsw@1649: } bsw@1649: slot.put(" | ") bsw@1649: ui.tag { content = _"implemented:" } bsw@1649: slot.put ( " " ) bsw@1649: ui.bargraph{ bsw@1649: max_value = with_opinion, bsw@1649: width = 100, bsw@1649: bars = { bsw@1649: { color = "#0a0", value = suggestion.plus2_fulfilled_count }, bsw@1649: { color = "#8a8", value = suggestion.plus1_fulfilled_count }, bsw@1649: { color = "#eee", value = neutral2 }, bsw@1649: { color = "#a88", value = suggestion.minus1_fulfilled_count }, bsw@1649: { color = "#a00", value = suggestion.minus2_fulfilled_count }, bsw@1649: } bsw@1649: } bsw@1649: end } bsw@1649: end bsw@1649: