liquid_feedback_frontend

diff model/member.lua @ 1696:446d2798f424

Automatically switch to single unit mode for users having only one unit
author bsw
date Thu Sep 23 17:47:58 2021 +0200 (2021-09-23)
parents 45287f1037fb
children
line diff
     1.1 --- a/model/member.lua	Thu Sep 23 14:30:18 2021 +0200
     1.2 +++ b/model/member.lua	Thu Sep 23 17:47:58 2021 +0200
     1.3 @@ -837,6 +837,19 @@
     1.4    return self.__units_with_polling_right_hash[unit_id] and true or false
     1.5  end
     1.6  
     1.7 +function Member.object:get_single_unit_id()
     1.8 +  populate_units_with_voting_right_hash(self)
     1.9 +  local single_unit_id
    1.10 +  local count = 0
    1.11 +  for unit_id in pairs(self.__units_with_voting_right_hash) do
    1.12 +    single_unit_id = unit_id
    1.13 +    count = count + 1
    1.14 +  end
    1.15 +  if count == 1 then
    1.16 +    return single_unit_id
    1.17 +  end
    1.18 +end
    1.19 +
    1.20  function Member.object:get_delegatee_member(unit_id, area_id, issue_id)
    1.21    local selector = Member:new_selector()
    1.22    if unit_id then

Impressum / About Us