mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
export balances
This commit is contained in:
parent
e155282234
commit
a429216639
1 changed files with 14 additions and 2 deletions
|
@ -578,7 +578,7 @@ local function r_users(show_special)
|
||||||
|
|
||||||
local show_user = function(user)
|
local show_user = function(user)
|
||||||
local is_spu = user.name:sub(1, 1) == "@"
|
local is_spu = user.name:sub(1, 1) == "@"
|
||||||
local filter_out = query.prefix ~= nil and user.name:sub(1,1):lower() ~= query.prefix
|
local filter_out = query.prefix ~= nil and user.name:sub(1, 1):lower() ~= query.prefix
|
||||||
if is_spu == show_special and not filter_out then
|
if is_spu == show_special and not filter_out then
|
||||||
print(format([[<li>
|
print(format([[<li>
|
||||||
<a href="/{username_url}">
|
<a href="/{username_url}">
|
||||||
|
@ -766,6 +766,14 @@ local function r_export_products()
|
||||||
print(l)
|
print(l)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function r_export_balances()
|
||||||
|
print("Status: 200")
|
||||||
|
print("Content-Type: text/csv")
|
||||||
|
print("")
|
||||||
|
for user, balance in pairs(balances()) do
|
||||||
|
print(string.format("%s,%d", user, balance))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if path == "/" then
|
if path == "/" then
|
||||||
if query.about then
|
if query.about then
|
||||||
|
@ -787,7 +795,11 @@ if path == "/" then
|
||||||
elseif query.spus then
|
elseif query.spus then
|
||||||
return r_users(true)
|
return r_users(true)
|
||||||
elseif query.users then
|
elseif query.users then
|
||||||
|
if query.export then
|
||||||
|
return r_export_balances()
|
||||||
|
else
|
||||||
return r_users(false)
|
return r_users(false)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return r_users(false)
|
return r_users(false)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue