From 674db67a25f92a4dc2a5bd6f0ea42bc2b1005e9c Mon Sep 17 00:00:00 2001 From: "Riley L." Date: Tue, 26 Aug 2025 21:48:34 +0200 Subject: add csv export of balances, fix user creation --- abrechenbarkeit.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 4a01e7b..4b04dd3 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -436,6 +436,8 @@ local function r_transaction_post() local is_special = user_dst:sub(1, 1) == "@" if not is_special then local bal = balances()[user_dst] + if bal == nil then bal = 0 end + if amount < 0 and (( bal + amount ) <= (tonumber(config.balance_min) or -99999)) then return format([[

{+user.form.transaction.funds}

@@ -684,6 +686,20 @@ local function r_users(show_special, filter_negative) filter_negative = tonumber(filter_negative) or 0 end + if query.csv then + print("Status: 200") + print("Content-Type: text/csv") + print("") + print("abrechenbarkeit at " .. os.date("!%Y-%m-%dT%H:%M:%SZ")) + print("name;balance;time") + + local users = get_active_users() + for _, user in ipairs(users) do + print(user.name .. ";" .. user.balance .. ";" .. user.time) + end + return + end + return respond(200, "Abrechenbarkeit", function() local users = get_active_users() -- cgit v1.2.3-70-g09d2