From 6b58dd4bd52dcca1a17b4338cf6c438320904a37 Mon Sep 17 00:00:00 2001 From: znetsixe <73483679+znetsixe@users.noreply.github.com> Date: Tue, 20 Jan 2026 20:47:19 +0100 Subject: [PATCH] upgrades --- src/specificClass.js | 15 ++++++++++----- test/monster.specific.test.js | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/specificClass.js b/src/specificClass.js index 205ca89..0346eda 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -318,16 +318,20 @@ class Monster{ const flowRate = Number(this.q) || 0; const m3PerPulse = Number(this.m3PerPuls) || 0; const pulseFraction = Number(this.temp_pulse) || 0; - const targetVolumeM3 = Number(this.targetVolume) > 0 ? this.targetVolume / 1000 : 0; + const targetVolumeL = Number(this.targetVolume) > 0 ? this.targetVolume : 0; + const targetVolumeM3 = targetVolumeL > 0 ? targetVolumeL / 1000 : 0; const flowToNextPulseM3 = m3PerPulse > 0 ? Math.max(0, (1 - pulseFraction) * m3PerPulse) : 0; const timeToNextPulseSec = flowRate > 0 && flowToNextPulseM3 > 0 ? Math.round((flowToNextPulseM3 / (flowRate / 3600)) * 100) / 100 : 0; - const targetProgressPct = targetVolumeM3 > 0 - ? Math.round((this.m3Total / targetVolumeM3) * 10000) / 100 + const targetProgressPct = targetVolumeL > 0 + ? Math.round((this.bucketVol / targetVolumeL) * 10000) / 100 : 0; - const targetDeltaM3 = targetVolumeM3 > 0 - ? Math.round((this.m3Total - targetVolumeM3) * 10000) / 10000 + const targetDeltaL = targetVolumeL > 0 + ? Math.round((this.bucketVol - targetVolumeL) * 100) / 100 + : 0; + const targetDeltaM3 = targetVolumeL > 0 + ? Math.round((targetDeltaL / 1000) * 10000) / 10000 : 0; output.pulse = this.pulse; @@ -359,6 +363,7 @@ class Monster{ output.timeToNextPulseSec = timeToNextPulseSec; output.targetVolumeM3 = targetVolumeM3; output.targetProgressPct = targetProgressPct; + output.targetDeltaL = targetDeltaL; output.targetDeltaM3 = targetDeltaM3; output.predictedRateM3h = this.getPredictedFlowRate(); diff --git a/test/monster.specific.test.js b/test/monster.specific.test.js index 7373244..cf1e9b7 100644 --- a/test/monster.specific.test.js +++ b/test/monster.specific.test.js @@ -251,6 +251,7 @@ test('output includes pulse and flow fields', () => { assert.ok(Object.prototype.hasOwnProperty.call(output, 'timeToNextPulseSec')); assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetVolumeM3')); assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetProgressPct')); + assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaL')); assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3')); assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h')); });