mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 06:27:48 +00:00
ensure we have a reference value before we slice
This commit is contained in:
parent
8e7bfd080d
commit
2de628adac
@ -13,6 +13,7 @@ onconnect = function (e) {
|
|||||||
try {
|
try {
|
||||||
if (type === 'calculateRequest') {
|
if (type === 'calculateRequest') {
|
||||||
responseType = 'calculationRequestResult';
|
responseType = 'calculationRequestResult';
|
||||||
|
console.debug(`📫 Received new calculation request with callback ID ${callbackID}`);
|
||||||
result = calculateRequest(telemetryForComps, parameters, expression);
|
result = calculateRequest(telemetryForComps, parameters, expression);
|
||||||
} else if (type === 'calculateSubscription') {
|
} else if (type === 'calculateSubscription') {
|
||||||
responseType = 'calculationSubscriptionResult';
|
responseType = 'calculationSubscriptionResult';
|
||||||
@ -86,7 +87,7 @@ function calculate(dataFrame, parameters, expression) {
|
|||||||
if (referenceParameter.sampleSize && referenceParameter.sampleSize > 0) {
|
if (referenceParameter.sampleSize && referenceParameter.sampleSize > 0) {
|
||||||
// enforce sample size by ensuring referenceValue has the latest n elements
|
// enforce sample size by ensuring referenceValue has the latest n elements
|
||||||
// if we don't have at least the sample size, skip this iteration
|
// if we don't have at least the sample size, skip this iteration
|
||||||
if (referenceValue.length < referenceParameter.sampleSize) {
|
if (!referenceValue.length || referenceValue.length < referenceParameter.sampleSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
referenceValue = referenceValue.slice(-referenceParameter.sampleSize);
|
referenceValue = referenceValue.slice(-referenceParameter.sampleSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user