Skip to content

Commit

Permalink
fix(get-entities): Only include entities that meet all the conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Nov 7, 2023
1 parent 1d81fe8 commit 1c69dd3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nodes/get-entities/GetEntitiesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class GetEntitiesController extends InputOutputController<
entity.timeSinceChangedMs =
Date.now() - new Date(entity.last_changed).getTime();

let entityMatched = true;
for (const rule of rules) {
const value = selectn(rule.property, entity);
const result =
Expand All @@ -68,9 +69,12 @@ export default class GetEntitiesController extends InputOutputController<
(rule.logic !== 'jsonata' && value === undefined) ||
!result
) {
continue;
entityMatched = false;
break;
}
}

if (entityMatched) {
entities.push(entity);
}
}
Expand Down

0 comments on commit 1c69dd3

Please sign in to comment.