Refactor position handling in MeasurementContainer to use position values instead of names
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user