Refactor position handling in MeasurementContainer to use position values instead of names

This commit is contained in:
2025-09-17 13:21:35 +02:00
parent 3876f86530
commit 16e202e841

View File

@@ -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;