android app, extension of stats
All checks were successful
Deploy SingleChat / deploy (push) Successful in 40s
All checks were successful
Deploy SingleChat / deploy (push) Successful in 40s
This commit is contained in:
30
server/broadcast.js
Normal file → Executable file
30
server/broadcast.js
Normal file → Executable file
@@ -854,6 +854,12 @@ export function setupBroadcast(io, __dirname) {
|
||||
'Top 20 Namen (Anzahl, letzter Login)',
|
||||
topNamesDetail.length > 1200 ? `${topNamesDetail.slice(0, 1197)}…` : topNamesDetail
|
||||
);
|
||||
const latest30Names = records
|
||||
.slice()
|
||||
.sort((a, b) => b.date - a.date)
|
||||
.slice(0, 30)
|
||||
.map((record) => record.userName);
|
||||
push('Letzte 30 Logins (neueste zuerst)', latest30Names.join(', ') || '—');
|
||||
push('Hinweis', 'Tabellen je Tag/Zeitraum: /stat today | /stat date | /stat range');
|
||||
|
||||
return rows;
|
||||
@@ -928,10 +934,24 @@ export function setupBroadcast(io, __dirname) {
|
||||
return;
|
||||
}
|
||||
const filtered = records.filter((r) => r.day >= from && r.day <= to);
|
||||
const perDay = aggregateTop(filtered, (r) => r.day, 1000)
|
||||
.sort((a, b) => a[0].localeCompare(b[0]))
|
||||
.map(([day, count]) => [day, count]);
|
||||
sendCommandTable(socket, `Statistik: Zeitraum ${from} bis ${to}`, ['Tag', 'Logins'], perDay);
|
||||
const recordsByDay = new Map();
|
||||
for (const record of filtered) {
|
||||
const dayRecords = recordsByDay.get(record.day) || [];
|
||||
dayRecords.push(record);
|
||||
recordsByDay.set(record.day, dayRecords);
|
||||
}
|
||||
const perDay = Array.from(recordsByDay.entries())
|
||||
.sort(([dayA], [dayB]) => dayA.localeCompare(dayB))
|
||||
.map(([day, dayRecords]) => {
|
||||
const names = dayRecords
|
||||
.map((record) => record.userName)
|
||||
.sort((a, b) => a.localeCompare(b, 'de'));
|
||||
const namesDisplay = dayRecords.length < 10
|
||||
? names.join(', ')
|
||||
: `${names.slice(0, 10).join(', ')}, …`;
|
||||
return [day, dayRecords.length, namesDisplay];
|
||||
});
|
||||
sendCommandTable(socket, `Statistik: Zeitraum ${from} bis ${to}`, ['Tag', 'Logins', 'Namen'], perDay);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1155,7 @@ export function setupBroadcast(io, __dirname) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (command === '/stat') {
|
||||
if (command === '/stat' || command === '/stats') {
|
||||
executeStatsCommand(socket, client, parts);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user