Skip to content

Node.js based forum software built for the modern web

fix dashboard stats

Barış Soner Uşaklı41bd65e81a1a
diff --git a/src/socket.io/admin/rooms.js b/src/socket.io/admin/rooms.js
index bf66873a52..d5e6dd5da6 100644
--- a/src/socket.io/admin/rooms.js
+++ b/src/socket.io/admin/rooms.js
@@ -105,28 +105,26 @@ function getLocalStats(callback) {
onlineRegisteredCount: websockets.getOnlineUserCount(),
socketCount: websockets.getSocketCount(),
users: {
- categories: roomClients.categories ? Object.keys(roomClients.categories).length : 0,
- recent: roomClients.recent_topics ? Object.keys(roomClients.recent_topics).length : 0,
- unread: roomClients.unread_topics ? Object.keys(roomClients.unread_topics).length: 0,
+ categories: roomClients.categories ? roomClients.categories.length : 0,
+ recent: roomClients.recent_topics ? roomClients.recent_topics.length : 0,
+ unread: roomClients.unread_topics ? roomClients.unread_topics.length: 0,
topics: 0,
category: 0
},
topics: {}
};
- var topTenTopics = [],
- tid;
+ var topTenTopics = [];
+ var tid;
for (var room in roomClients) {
if (roomClients.hasOwnProperty(room)) {
tid = room.match(/^topic_(\d+)/);
if (tid) {
- var length = Object.keys(roomClients[room]).length;
- socketData.users.topics += length;
-
- topTenTopics.push({tid: tid[1], count: length});
+ socketData.users.topics += roomClients[room].length;
+ topTenTopics.push({tid: tid[1], count: roomClients[room].length});
} else if (room.match(/^category/)) {
- socketData.users.category += Object.keys(roomClients[room]).length;
+ socketData.users.category += roomClients[room].length;
}
}
}