diff options
-rwxr-xr-x | abrechenbarkeit.lua | 16 |
1 files changed, 16 insertions, 0 deletions
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([[ <div class="notif error"><p>{+user.form.transaction.funds}</p></div> @@ -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() |