From 15f4cc0c85ed26175ce84e297190f698b4789209 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 26 Nov 2024 19:26:30 +0100 Subject: [PATCH] expand inactive users when filter is applied --- abrechenbarkeit.lua | 56 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 41b4e8f..5bdd4ab 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -536,8 +536,8 @@ local function r_users(show_special, filter_negative) end return respond(200, "Abrechenbarkeit", function() - local users = get_active_users() - + local users = get_active_users() + if not show_special then print(format([[
@@ -548,34 +548,34 @@ local function r_users(show_special, filter_negative)
]])) - -- get first letters - local firstletters = {} - local function contains(char) - for _, firstchar in ipairs(firstletters) do - if firstchar == char then - return true - end - end + -- get first letters + local firstletters = {} + local function contains(char) + for _, firstchar in ipairs(firstletters) do + if firstchar == char then + return true + end + end - return false - end - - for _, user in ipairs(users) do - user.firstchar = user.name:sub(1,1):lower() - if user.firstchar ~= "@" and not contains(user.firstchar) then - table.insert(firstletters, user.firstchar) - end - end + return false + end - table.sort(firstletters) + for _, user in ipairs(users) do + user.firstchar = user.name:sub(1, 1):lower() + if user.firstchar ~= "@" and not contains(user.firstchar) then + table.insert(firstletters, user.firstchar) + end + end + + table.sort(firstletters) print(format([[

{+users.filter}

]]) + for k, letter in ipairs(firstletters) do + print(format([[
  • {letter}
  • ]], { + letter = letter, + })) + end + print([[]]) end print([[
    ]]) -- for printing print([[