Enhance daily statistics reporting in broadcast.js

- Updated the statistics for 'today' to include a list of unique users who logged in, improving the detail and usefulness of the data presented.
- Modified the command table structure to display metrics more clearly, including the date, total logins, and unique users logged in today.

These changes enhance the clarity and depth of user engagement statistics.
This commit is contained in:
Torsten Schulz (local)
2026-03-19 15:42:49 +01:00
parent 8319b43835
commit c847f249ba

View File

@@ -419,7 +419,13 @@ export function setupBroadcast(io, __dirname) {
if (sub === 'today') { if (sub === 'today') {
const day = new Date().toISOString().slice(0, 10); const day = new Date().toISOString().slice(0, 10);
const dayRecords = records.filter((r) => r.day === day); const dayRecords = records.filter((r) => r.day === day);
sendCommandTable(socket, 'Statistik: Heute', ['Tag', 'Logins'], [[day, dayRecords.length]]); const uniqueUsersToday = Array.from(new Set(dayRecords.map((r) => r.userName)))
.sort((a, b) => a.localeCompare(b, 'de'));
sendCommandTable(socket, 'Statistik: Heute', ['Metrik', 'Wert'], [
['Tag', day],
['Logins', dayRecords.length],
['Heute eingeloggt', uniqueUsersToday.length > 0 ? uniqueUsersToday.join(', ') : '-']
]);
return; return;
} }
@@ -1376,4 +1382,3 @@ export function setupBroadcast(io, __dirname) {
} }
}, 60000); }, 60000);
} }