From 251b8bd0384d42674327790e72ed1046ba4df997 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Tue, 15 Oct 2024 21:53:01 +0200 Subject: [PATCH 1/2] only emit telemetry if we have a result --- src/plugins/condition/ConditionManager.js | 4 +--- src/plugins/condition/ConditionSetTelemetryProvider.js | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/condition/ConditionManager.js b/src/plugins/condition/ConditionManager.js index 17eeecbf8f..10b7409eb6 100644 --- a/src/plugins/condition/ConditionManager.js +++ b/src/plugins/condition/ConditionManager.js @@ -391,9 +391,7 @@ export default class ConditionManager extends EventEmitter { result, ...timestamp }; - if (result) { - this.emit('conditionSetResultTrue', conditionSetResult); - } + this.emit('conditionSetResultUpdated', conditionSetResult); } updateCurrentCondition(timestamp, telemetryObject, telemetryData) { diff --git a/src/plugins/condition/ConditionSetTelemetryProvider.js b/src/plugins/condition/ConditionSetTelemetryProvider.js index 9abf3d2e99..5272b03ae7 100644 --- a/src/plugins/condition/ConditionSetTelemetryProvider.js +++ b/src/plugins/condition/ConditionSetTelemetryProvider.js @@ -50,7 +50,9 @@ export default class ConditionSetTelemetryProvider { let conditionManager = this.getConditionManager(domainObject); conditionManager.on('conditionSetResultUpdated', (data) => { - callback(data); + if (data?.result){ + callback(data); + } }); return this.destroyConditionManager.bind( From 397ba314b54287957924009fc2637868e20471e6 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Tue, 15 Oct 2024 21:54:37 +0200 Subject: [PATCH 2/2] lint --- src/plugins/condition/ConditionSetTelemetryProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/condition/ConditionSetTelemetryProvider.js b/src/plugins/condition/ConditionSetTelemetryProvider.js index 5272b03ae7..8a0d9e17e1 100644 --- a/src/plugins/condition/ConditionSetTelemetryProvider.js +++ b/src/plugins/condition/ConditionSetTelemetryProvider.js @@ -50,7 +50,7 @@ export default class ConditionSetTelemetryProvider { let conditionManager = this.getConditionManager(domainObject); conditionManager.on('conditionSetResultUpdated', (data) => { - if (data?.result){ + if (data?.result) { callback(data); } });