format time in logo

This commit is contained in:
metamuffin 2024-11-03 22:34:04 +01:00
parent f71092470d
commit 9f453051c7
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654

View file

@ -172,7 +172,7 @@ local function get_active_users()
user_balances[username] = {
time = time,
username = username,
balance = (user_balances[username] or {balance = 0}).balance + amount
balance = (user_balances[username] or { balance = 0 }).balance + amount
}
end
@ -181,16 +181,7 @@ local function get_active_users()
table.insert(users, user)
end
table.sort(users, function(a,b) return a.time > b.time end)
for k, user in pairs(users) do
io.stderr:write(string.format("%s %s %s %s\n",
k,
os.date("!%Y-%m-%dT%H:%M:%SZ", user.time),
user.username,
user.balance
))
end
table.sort(users, function(a, b) return a.time > b.time end)
return users
end
@ -210,7 +201,8 @@ local function r_user_post(username)
pcount = (tonumber(data.pcount) or 1) * (data.negate_pcount ~= nil and -1 or 1)
pcode = p_barcode
if amount == nil then amount = pcount * p_amount end
if comment == nil then comment = string.format("%s %d %s", pcount < 0 and "Buy" or "Restock", math.abs(pcount), p_name) end
if comment == nil then comment = string.format("%s %d %s", pcount < 0 and "Buy" or "Restock",
math.abs(pcount), p_name) end
end
end
if amount == nil then
@ -331,7 +323,7 @@ local function r_log(filter)
if filter == nil or filter == username then
print(string.format([[
<tr>
<td>%d (%s ago)</td>
<td>%s (%s ago)</td>
<td>%s</td>
<td class="amount-%s">%.02f</td>
<td>%s</td>
@ -346,7 +338,7 @@ local function r_log(filter)
</td>
</tr>
]],
time, format_duration(os.time() - time),
os.date("!%Y-%m-%dT%H:%M:%SZ", time), format_duration(os.time() - time),
escape(username),
amount >= 0 and "pos" or "neg", amount / 100,
escape(pcode) or "",