Merge remote-tracking branch 'origin/telemetry-comps' into combined-rodap-stuff

This commit is contained in:
Scott Bell 2024-10-14 15:28:40 +02:00
commit f9efc71f54

View File

@ -122,8 +122,18 @@ function calculate(dataFrame, parameters, expression) {
console.debug('🤦‍♂️ Missing data for some parameters, skipping calculation'); console.debug('🤦‍♂️ Missing data for some parameters, skipping calculation');
return; return;
} }
const value = evaluate(expression, scope); const rawComputedValue = evaluate(expression, scope);
sumResults.push({ [referenceParameter.timeKey]: referenceTime, value }); let computedValue = rawComputedValue;
if (computedValue.entries) {
// if there aren't any entries, return with nothing
if (computedValue.entries.length === 0) {
return;
}
console.debug('📊 Computed value is an array of entries', computedValue.entries);
// make array of arrays of entries
computedValue = computedValue.entries?.[0];
}
sumResults.push({ [referenceParameter.timeKey]: referenceTime, value: computedValue });
}); });
return sumResults; return sumResults;
} }