From b5797b7db05c95a1401bfbc5d8ba78783037bfec Mon Sep 17 00:00:00 2001 From: Philip Robinson Date: Thu, 31 Mar 2022 14:22:12 +0100 Subject: [PATCH] fix: recovery daily test reporting of uT was rounding incorrectly (#3992) Description --- This PR deals with a reported float T value correctly in the report. How Has This Been Tested? --- UNTESTED! --- applications/daily_tests/automatic_recovery_test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/daily_tests/automatic_recovery_test.js b/applications/daily_tests/automatic_recovery_test.js index df6fc62c92..c305f92e89 100644 --- a/applications/daily_tests/automatic_recovery_test.js +++ b/applications/daily_tests/automatic_recovery_test.js @@ -87,10 +87,13 @@ async function run(options = {}) { let scannedMatch = data.match(RECOVERY_COMPLETE_REGEXP); let recoveredAmountMatch = data.match(RECOVERY_WORTH_REGEXP); if (scannedMatch && recoveredAmountMatch) { - let recoveredAmount = parseInt(recoveredAmountMatch[1]); + // JS probably doesn't care but rust would! + let recoveredAmount = 0; if (recoveredAmountMatch[2] === "T") { // convert to micro tari - recoveredAmount *= 1000000; + recoveredAmount = round(parseFloat(recoveredAmountMatch[1]) * 1000000); + } else { + recoveredAmount = parseInt(recoveredAmountMatch[1]); } return { numScanned: parseInt(scannedMatch[1]),