From 16e202e84122f8d63d3270f47ab6bf1cf2850b60 Mon Sep 17 00:00:00 2001
From: "p.vanderwilt"
Date: Wed, 17 Sep 2025 13:21:35 +0200
Subject: [PATCH] Refactor position handling in MeasurementContainer to use
position values instead of names
---
src/measurements/MeasurementContainer.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
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;