Skip to content

Commit 3491473

Browse files
authored
All telemetry criteria bug (#8084)
* Reference telemetry map as a Map, not associative array * Only normalize once * Another cheeky createNormalizedDatum * Fix unit tests that were broken by removal of createNormalizedDatum * Fixed failing test
1 parent 4aea6a5 commit 3491473

File tree

6 files changed

+32
-15
lines changed

6 files changed

+32
-15
lines changed

src/plugins/condition/ConditionSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('The condition', function () {
6969
}
7070
},
7171
{
72-
key: 'testSource',
72+
key: 'value',
7373
source: 'value',
7474
name: 'Test',
7575
format: 'string'
@@ -130,7 +130,7 @@ describe('The condition', function () {
130130
id: '1234-5678-9999-0000',
131131
operation: 'equalTo',
132132
input: ['0'],
133-
metadata: 'testSource',
133+
metadata: 'value',
134134
telemetry: testTelemetryObject.identifier
135135
}
136136
]

src/plugins/condition/criterion/AllTelemetryCriterion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { checkIfOld, getLatestTimestamp } from '../utils/time.js';
2828
import TelemetryCriterion from './TelemetryCriterion.js';
2929

3030
export default class AllTelemetryCriterion extends TelemetryCriterion {
31+
#emptyMap = new Map();
3132
/**
3233
* Subscribes/Unsubscribes to telemetry and emits the result
3334
* of operations performed on the telemetry data returned and a given input value.
@@ -176,23 +177,22 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
176177
return datum;
177178
}
178179

179-
updateResult(data, telemetryObjects) {
180-
const validatedData = this.isValid() ? data : {};
180+
updateResult(allTelemetryDataMap, telemetryObjects) {
181+
const validatedData = this.isValid() ? allTelemetryDataMap : this.#emptyMap;
181182

182183
if (validatedData && !this.isStalenessCheck()) {
183184
if (this.isOldCheck()) {
184185
Object.keys(this.telemetryDataCache).forEach((objectIdKeystring) => {
185186
if (this.ageCheck?.[objectIdKeystring]) {
186-
this.ageCheck[objectIdKeystring].update(validatedData[objectIdKeystring]);
187+
this.ageCheck[objectIdKeystring].update(validatedData.get(objectIdKeystring));
187188
}
188189

189190
this.telemetryDataCache[objectIdKeystring] = false;
190191
});
191192
} else {
192193
Object.keys(this.telemetryDataCache).forEach((objectIdKeystring) => {
193-
const telemetryObject = telemetryObjects[objectIdKeystring];
194194
this.telemetryDataCache[objectIdKeystring] = this.computeResult(
195-
this.createNormalizedDatum(validatedData[objectIdKeystring], telemetryObject)
195+
validatedData.get(objectIdKeystring)
196196
);
197197
});
198198
}

src/plugins/condition/criterion/TelemetryCriterion.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ export default class TelemetryCriterion extends EventEmitter {
194194
return dataIsDefined && (hasTimeSystemChanged || isCacheStale);
195195
}
196196
updateResult(data, currentTimeSystemKey) {
197-
const validatedData = this.isValid()
198-
? this.createNormalizedDatum(data, this.telemetryObject)
199-
: {};
197+
const validatedData = this.isValid() ? data : {};
200198

201199
if (!this.isStalenessCheck()) {
202200
if (this.isOldCheck()) {

src/plugins/condition/criterion/TelemetryCriterionSpec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,14 @@ describe('The telemetry criterion', function () {
125125
});
126126

127127
it('returns a result on new data from relevant telemetry providers', function () {
128-
telemetryCriterion.updateResult({
129-
value: 'Hello',
130-
utc: 'Hi',
131-
id: testTelemetryObject.identifier.key
132-
});
128+
telemetryCriterion.updateResult(
129+
{
130+
testSource: 'Hello',
131+
utc: 'Hi',
132+
id: testTelemetryObject.identifier.key
133+
},
134+
'utc'
135+
);
133136
expect(telemetryCriterion.result).toBeTrue();
134137
});
135138

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Questions for Vickie
2+
I am remote on Monday and Tuesday for Mel's birthday
3+
Have coordinate with Keith and he can be in the MMOC on Monday to test out the PIV transition
4+
Which machines has PIV been tested from?
5+
6+
What do we have for CCB on Tuesday?
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Stay Interview notes
2+
* Why do I work here?
3+
* Interesting projects, great people, flexibility.
4+
5+
* What would I like?
6+
* More paid leave. If you can't compete on salary you have to offer competitive benefits.
7+
8+
* I'd like to work on wild fire detection and management if we have anything going there
9+
* Green energy
10+
* Human spaceflight also interests me.

0 commit comments

Comments
 (0)