liquid_feedback_frontend

diff lib/firstlife/groups.lua @ 1533:d432f85e868e

Completed firstlife group mirror feature
author bsw
date Mon Oct 05 15:51:47 2020 +0200 (2020-10-05)
parents 3c15fea3f1c0
children
line diff
     1.1 --- a/lib/firstlife/groups.lua	Sun Oct 04 16:31:47 2020 +0200
     1.2 +++ b/lib/firstlife/groups.lua	Mon Oct 05 15:51:47 2020 +0200
     1.3 @@ -17,13 +17,13 @@
     1.4    local new_user_hash = {}
     1.5  
     1.6    for i, user in ipairs(data) do
     1.7 -    print("  Processing user ID " .. user.id)
     1.8 +--    print("  Processing user ID " .. user.id)
     1.9      local user_id = tonumber(string.match(user.id, "^(.+)@"))
    1.10      new_user_hash[user_id] = user
    1.11      if old_privileges[user_id] then
    1.12 -      print("    Privilege entry exists")
    1.13 +--      print("    Privilege entry exists")
    1.14      else
    1.15 -      print("    Creating new privilege")
    1.16 +--      print("    Creating new privilege")
    1.17        local privilege = Privilege:new()
    1.18        privilege.unit_id = unit.id
    1.19        privilege.member_id = user_id
    1.20 @@ -36,7 +36,7 @@
    1.21  
    1.22    for i, old_privilege in ipairs(old_privileges_list) do
    1.23      if not new_user_hash[old_privilege.member_id] then
    1.24 -      print("  Destroying privilege for user ID " .. old_privilege.member_id)
    1.25 +--      print("  Destroying privilege for user ID " .. old_privilege.member_id)
    1.26        old_privilege:destroy()
    1.27      end
    1.28    end
    1.29 @@ -61,7 +61,7 @@
    1.30    local units_new = {}
    1.31  
    1.32    for i, feature in ipairs(data.things.features) do
    1.33 -    print(feature.id, feature.properties.name)
    1.34 +--    print(feature.id, feature.properties.name)
    1.35      units_new[feature.id] = feature
    1.36    end
    1.37  
    1.38 @@ -78,19 +78,19 @@
    1.39    for id, unit_new in pairs(units_new) do
    1.40      local name_new = unit_new.properties.name
    1.41      local unit
    1.42 -    print("Processing unit ID " .. id .. " with name " .. name_new)
    1.43 +--    print("Processing unit ID " .. id .. " with name " .. name_new)
    1.44      if old_units[id] then
    1.45        unit = old_units[id]
    1.46 -      print("  Unit already exists")
    1.47 +--      print("  Unit already exists")
    1.48        if old_units[id].name == name_new then
    1.49 -        print("  Name not changed")
    1.50 +--        print("  Name not changed")
    1.51        else
    1.52 -        print("  Name changed, updating")
    1.53 +--        print("  Name changed, updating")
    1.54          old_units[id].name = name_new
    1.55          old_units[id]:save()
    1.56        end
    1.57      else          
    1.58 -      print("  Creating as new unit")
    1.59 +--      print("  Creating as new unit")
    1.60        local u = Unit:new()
    1.61        u.name = name_new
    1.62        u.attr = json.object()
    1.63 @@ -112,4 +112,3 @@
    1.64  
    1.65  end
    1.66  
    1.67 -

Impressum / About Us