Enhance user statistics reporting in broadcast.js

- Updated the command table to include the last login timestamp for each user, providing more detailed insights into user engagement.
- Modified the structure of the statistics display to improve clarity and usefulness of the data presented.

These changes enhance the depth of user engagement statistics and improve overall reporting accuracy.
This commit is contained in:
Torsten Schulz (local)
2026-03-19 15:45:33 +01:00
parent c847f249ba
commit e8e1eb4e25

View File

@@ -473,8 +473,13 @@ export function setupBroadcast(io, __dirname) {
sendCommandTable(
socket,
`Statistik: Namen (gesamt verschieden: ${new Set(records.map((r) => r.userName)).size})`,
['Name', 'Anzahl'],
topNames.map(([name, count]) => [name, count])
['Name', 'Anzahl', 'Letzter Login'],
topNames.map(([name, count]) => {
const latestRecord = records
.filter((r) => r.userName === name)
.sort((a, b) => b.date - a.date)[0];
return [name, count, latestRecord ? latestRecord.timestamp : '-'];
})
);
return;
}