From 80cf5a6ccd6a800bcf9294ec2f8a90aadf800f4e Mon Sep 17 00:00:00 2001 From: "Riley L." Date: Wed, 20 Nov 2024 21:59:27 +0100 Subject: [PATCH] add maximum url parameter; document special list in readme --- abrechenbarkeit.lua | 8 ++++---- readme.md | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index b7636a1..b7ec392 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -584,7 +584,7 @@ local function r_users(show_special, filter_negative) local is_spu = user.name:sub(1, 1) == "@" local filter_out = query.prefix ~= nil and user.name:sub(1, 1):lower() ~= query.prefix if (filter_negative ~= nil and user.balance < filter_negative) - or (filter_negative == nil and is_spu == show_special and not filter_out) then + or (filter_negative == nil and is_spu == show_special and (not filter_out)) then print(format([[
  • {!username} @@ -599,9 +599,10 @@ local function r_users(show_special, filter_negative) end local inactive_cutoff = os.time() - (tonumber(config.inactive_cutoff) or (30 * 24 * 60 * 60)) for _, user in ipairs(get_active_users()) do - if user.time > inactive_cutoff then show_user(user) end + if filter_negative or user.time > inactive_cutoff then show_user(user) end end print("") + if filter_negative ~= nil then return end print(format([[
    {+users.inactive_list}
      ]])) for _, user in ipairs(users) do if user.time <= inactive_cutoff then show_user(user) end @@ -802,8 +803,7 @@ if path == "/" then elseif query.users and query.export then return r_export_balances() else - return r_users(false, query.negative) - -- tonumber(query.negative or 0) or nil) + return r_users(false, query.negative and (query.maximum or 0)) end else local username = extract_username() diff --git a/readme.md b/readme.md index 2d8a6a6..544bb06 100644 --- a/readme.md +++ b/readme.md @@ -23,3 +23,8 @@ useful for development or proxyless deployments. curl 'http://strichliste.example.org/api/user?deleted=false' | jq -r '.users.[] | [ 0, "@Potential", .name, .balance, "", "", "" ] | join(",")' > log curl 'http://strichliste.example.org/api/article' | jq -r '.articles.[] | [ .barcode, .amount, "@Drinks", .name ] | join(",")' > products ``` + +## Non-linked User lists + +- list of Users with negative balance: `http://abrechenbarkeit.example.org/?negative` +- list of Users with balance lower than : `http://abrechenbarkeit.example.org/?negative&maximum=`