mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
fixe
This commit is contained in:
@@ -227,8 +227,16 @@ function turnOffAllRoverNightVision() {
|
||||
|
||||
function getActiveDriverCount() {
|
||||
const active = getActiveDrivers();
|
||||
if (!active || typeof active !== 'object') return 0;
|
||||
return Object.keys(active).length;
|
||||
const turnCount = active && typeof active === 'object' ? Object.keys(active).length : 0;
|
||||
if (turnCount > 0) return turnCount;
|
||||
// Fallback: trust live rover driver sets if turn-service tracking is temporarily out of sync.
|
||||
let liveCount = 0;
|
||||
roverManager.rovers.forEach((record) => {
|
||||
if (record?.drivers?.size > 0) {
|
||||
liveCount += 1;
|
||||
}
|
||||
});
|
||||
return liveCount;
|
||||
}
|
||||
|
||||
function hasActiveDrivers() {
|
||||
|
||||
@@ -43,6 +43,10 @@ function createSpectatorAccess(deps) {
|
||||
privateNoUsersSince.delete(record.id);
|
||||
continue;
|
||||
}
|
||||
if (record.drivers && record.drivers.size > 0) {
|
||||
privateNoUsersSince.delete(record.id);
|
||||
continue;
|
||||
}
|
||||
if (onlineCount > 0) {
|
||||
privateNoUsersSince.delete(record.id);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user