improve result list visuals
This commit is contained in:
parent
4e278feed1
commit
0e04d59936
24
voting.lua
24
voting.lua
@ -1,7 +1,8 @@
|
||||
-- luacheck: globals event mem digiline_send interrupt, no max line length
|
||||
-- The machine requires _three_ touch screens connected: one set to channel "vote", other set to "admin", and third to "submit"
|
||||
|
||||
-- FIXME: "results" view not opening when there are no votes?
|
||||
-- TODO: show names if people in results view
|
||||
-- TODO: use a real table for results (and color it?)
|
||||
|
||||
local categories = {"Creativity", "Aesthetic\n Appeal", "Detail & \nExecution", "Use of\nspace"}
|
||||
local num_categories = #categories
|
||||
@ -111,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 {}
|
||||
@ -191,10 +192,23 @@ local function show_admin_results()
|
||||
|
||||
-- actually generate strings for the results table
|
||||
local entry_list = {}
|
||||
local t_s = {} -- temp scores
|
||||
local color_idx = (type(mem.sort_type) == "number") and mem.sort_type or 0
|
||||
for _, s in ipairs(total_scores) do
|
||||
local name = mem.entries_by_id[s.id].title
|
||||
local sum = s[1] + s[2] + s[3] + s[4]
|
||||
table.insert(entry_list, string.format("%03d || %03d | %03d | %03d | %03d -- %s", sum, s[1], s[2], s[3], s[4], name))
|
||||
local e = mem.entries_by_id[s.id]
|
||||
local name = e.user
|
||||
local title = e.title
|
||||
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
|
||||
if k == color_idx then
|
||||
t_s[k] = ("[%03d]"):format(v)
|
||||
else
|
||||
t_s[k] = (" %03d "):format(v)
|
||||
end
|
||||
end
|
||||
--t_s[color_idx] = ("\27(c@green)%s\27(c@#ffffff)"):format(t_s[color_idx])
|
||||
table.insert(entry_list, ("%s || %s | %s | %s | %s -- [%s] %s"):format(t_s[0], t_s[1], t_s[2], t_s[3], t_s[4], name, title))
|
||||
end
|
||||
|
||||
if not next(entry_list) then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user