add a refresh button to results view

This commit is contained in:
whosit 2025-03-24 16:04:31 +03:00
parent 6e5774a12c
commit 8e779c1c76

View File

@ -112,7 +112,7 @@ local function show_admin_edit()
-- screen for adding/removing entries
local list_entries = {}
for _,e in ipairs(mem.entries) do
table.insert(list_entries, string.format("%s | [%s] - %s", e.accepted and "#00FF00[+]" or "[-]", e.user or "", e.title or ""))
table.insert(list_entries, string.format("%s | [%s] - %s", e.accepted and "#00FF00[+]" or "[-]", e.user or "???", e.title or "???"))
end
local entry = mem.entries[mem.admin_entries_idx] or {}
@ -138,6 +138,7 @@ local function show_admin_edit()
{command = "add", element = "field_close_on_enter", name = "new_entry", close_on_enter = false},
{command = "addbutton", name = "edit_back", label = "Back", X = 12.7, Y = 0.3, W = 1.7, H = 0.8},
{command = "addbutton", name = "edit_refresh", label = "Refresh", X = 12.7, Y = 1.3, W = 1.7, H = 0.8},
}
)
end
@ -196,8 +197,8 @@ local function show_admin_results()
local color_idx = (type(mem.sort_type) == "number") and mem.sort_type or 0
for _, s in ipairs(total_scores) do
local e = mem.entries_by_id[s.id]
local name = e.user
local title = e.title
local name = (e or {}).user or "???"
local title = (e or {}).title or ("<id:%s>"):format(s.id)
t_s[0] = s[1] + s[2] + s[3] + s[4]
t_s[1], t_s[2], t_s[3], t_s[4] = s[1], s[2], s[3], s[4]
for k,v in pairs(t_s) do
@ -655,6 +656,8 @@ elseif event.type == "digiline" then
elseif event.msg.edit_back then
mem.state_admin = "welcome"
show_admin_welcome()
elseif event.msg.edit_refresh then
show_admin_edit()
end
elseif mem.state_admin == "results" then
if event.msg.results_back then