diff --git a/src/measurements/MeasurementContainer.js b/src/measurements/MeasurementContainer.js index 20099f8..97b7f7d 100644 --- a/src/measurements/MeasurementContainer.js +++ b/src/measurements/MeasurementContainer.js @@ -88,11 +88,11 @@ class MeasurementContainer { return this; } - position(positionName) { + position(positionValue) { if (!this._currentVariant) { throw new Error('Variant must be specified before position'); } - this._currentPosition = positionName; + this._currentPosition = positionValue; return this; } @@ -243,10 +243,12 @@ class MeasurementContainer { const savedPosition = this._currentPosition; // Get upstream and downstream measurements - this._currentPosition = 'upstream'; + const positions = this.getPositions(); + + this._currentPosition = Math.min(...positions); const upstream = this.get(); - this._currentPosition = 'downstream'; + this._currentPosition = Math.max(...positions); const downstream = this.get(); this._currentPosition = savedPosition;