From 19404ff2113386064b988bb3aa08463f5c4b5043 Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Sun, 16 Mar 2025 14:16:29 -0400 Subject: [PATCH] button fix --- app.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index a0257d7..107df17 100644 --- a/app.js +++ b/app.js @@ -163,15 +163,7 @@ function renderData() { const key = keys[i]; const val = datas[key]; - let buttons = []; - for (let i = 0; i < Object.keys(qr).length; i++) { - const k = Object.keys(qr)[i]; - if (qr[k]) { - buttons.push(k); - } - } - - html += `<tr><td>${key}</td><td>${val}</td><td>${buttons}</td></tr>`; + html += `<tr><td>${key}</td><td>${val.count}</td><td>${val.buttons}</td></tr>`; } html += "</table>"; @@ -287,8 +279,19 @@ function tick() { "#FF3B58", ); - datas[code.data] ||= 0; - datas[code.data] += 1; + if (!datas[code.data]) { + let buttons = []; + for (let i = 0; i < Object.keys(qr).length; i++) { + const k = Object.keys(qr)[i]; + if (qr[k]) { + buttons.push(k); + } + } + + datas[code.data] = { count: 1, buttons }; + } else { + datas[code.data].count += 1; + } renderData(); } -- GitLab