check if sample size greater than zero

This commit is contained in:
Scott Bell 2024-10-09 10:24:57 +02:00
parent 3f92deb896
commit c6806944eb

View File

@ -1,3 +1,4 @@
import { sampleSize } from 'lodash';
import { evaluate } from 'mathjs';
// eslint-disable-next-line no-undef
@ -83,7 +84,7 @@ function calculate(dataFrame, parameters, expression) {
accumulatedData[referenceParameter.name].push(referenceValue);
referenceValue = accumulatedData[referenceParameter.name];
}
if (referenceParameter.sampleSize) {
if (referenceParameter.sampleSize && sampleSize > 0) {
// 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 (referenceValue.length < referenceParameter.sampleSize) {