From 5122c685bec709ff530d5e8e784ab09db75d964e Mon Sep 17 00:00:00 2001 From: juancarmore Date: Mon, 2 Nov 2026 20:47:57 +0100 Subject: [PATCH] openvidu-dashboard: the rooms list reads the media statistics mark of its rooms --- .../backend/src/rooms/rooms-query.ts | 3 ++- .../backend/test/integration/rooms-api.test.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/openvidu-dashboard/dashboard-ce/backend/src/rooms/rooms-query.ts b/openvidu-dashboard/dashboard-ce/backend/src/rooms/rooms-query.ts index d4e3d90cd..c273f7a58 100644 --- a/openvidu-dashboard/dashboard-ce/backend/src/rooms/rooms-query.ts +++ b/openvidu-dashboard/dashboard-ce/backend/src/rooms/rooms-query.ts @@ -24,7 +24,8 @@ export const ROOM_LIST_PROJECTION: Readonly = { ingress: 1, bytes: 1, features: 1, - lastStatsAt: 1 + lastStatsAt: 1, + mediaStats: 1 }; /** diff --git a/openvidu-dashboard/dashboard-ce/backend/test/integration/rooms-api.test.ts b/openvidu-dashboard/dashboard-ce/backend/test/integration/rooms-api.test.ts index b77f9e219..6caa782d6 100644 --- a/openvidu-dashboard/dashboard-ce/backend/test/integration/rooms-api.test.ts +++ b/openvidu-dashboard/dashboard-ce/backend/test/integration/rooms-api.test.ts @@ -188,6 +188,22 @@ describe.skipIf(mongoUri === '')('rooms API', () => { expect(sids(await json(ce, '/rooms?q=rm_node&nodeId=node-a'))).toEqual(['RM_nodeA']); }); + it('carries the media statistics mark of the rooms whose node reports none, sorted or ranked', async () => { + await reseed(ce.dashboard.db, { + rooms: [ + activeRoom({ _id: 'RM_marked', createdAt: minutesAgo(5), mediaStats: false }), + activeRoom({ _id: 'RM_plain', createdAt: minutesAgo(4) }) + ] + }); + + for (const path of ['/rooms', '/rooms?sort=active']) { + const items = (await json>(ce, path)).items; + + expect(items.find((item) => item.sid === 'RM_marked')?.mediaStats).toBe(false); + expect(items.find((item) => item.sid === 'RM_plain')).not.toHaveProperty('mediaStats'); + } + }); + it('omits total beyond the exact-count range', async () => { await reseed(ce.dashboard.db, { rooms: [closedRoom({ _id: 'RM_one', createdAt: minutesAgo(10) })] });