обновление бизнес логики
This commit is contained in:
@@ -59,11 +59,24 @@ export const getSensorIdFromMesh = (m: AbstractMesh | null): string | null => {
|
||||
return null
|
||||
}
|
||||
|
||||
export const collectSensorMeshes = (meshes: AbstractMesh[]): AbstractMesh[] => {
|
||||
export const collectSensorMeshes = (
|
||||
meshes: AbstractMesh[],
|
||||
sensorStatusMap?: Record<string, string> | null
|
||||
): AbstractMesh[] => {
|
||||
const result: AbstractMesh[] = []
|
||||
for (const m of meshes) {
|
||||
const sid = getSensorIdFromMesh(m)
|
||||
if (sid) result.push(m)
|
||||
if (sid) {
|
||||
// Если передана карта статусов - фильтруем только по датчикам из неё
|
||||
if (sensorStatusMap) {
|
||||
if (sid in sensorStatusMap) {
|
||||
result.push(m)
|
||||
}
|
||||
} else {
|
||||
// Если карта не передана - возвращаем все датчики (старое поведение)
|
||||
result.push(m)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user