liquid_feedback_frontend

changeset 1853:9c298b5832e7

Correctly determine own voting weight
author bsw
date Tue Mar 22 13:52:26 2022 +0100 (2022-03-22)
parents e593570a23c5
children 220653575083
files app/main/delegation/_info.lua
line diff
     1.1 --- a/app/main/delegation/_info.lua	Tue Mar 22 10:35:44 2022 +0100
     1.2 +++ b/app/main/delegation/_info.lua	Tue Mar 22 13:52:26 2022 +0100
     1.3 @@ -223,10 +223,19 @@
     1.4          ui.tag{ tag = "i", attr = { id = "issue_" .. issue.id .. "_interest_icon", class = "material-icons" }, content = "star" }
     1.5        end
     1.6      }
     1.7 -    if not issue.closed and info.own_participation and info.weight and info.weight > 1 then
     1.8 +
     1.9 +    local privilege = Privilege:new_selector()
    1.10 +      :add_where{ "member_id = ?", member.id }
    1.11 +      :add_where{ "unit_id = ?", issue.area.unit_id }
    1.12 +      :optional_object_mode()
    1.13 +      :exec()
    1.14 +
    1.15 +    local own_weight = privilege and privilege.weight or 0
    1.16 +
    1.17 +    if not issue.closed and info.own_participation and info.weight and info.weight > own_weight then
    1.18        slot.put(" ")
    1.19        ui.link { 
    1.20 -        attr = { class = "right" }, content = "+" .. (info.weight - 1),
    1.21 +        attr = { class = "right" }, content = "+" .. (info.weight - own_weight),
    1.22          module = "interest", view = "show_incoming", params = { 
    1.23            issue_id = issue.id, member_id = member.id
    1.24          }

Impressum / About Us