Skip to content

Commit

Permalink
fix: recovery daily test reporting of uT was rounding incorrectly (#3992
Browse files Browse the repository at this point in the history
)

Description
---
This PR deals with a reported float T value correctly in the report.


How Has This Been Tested?
---
UNTESTED!
  • Loading branch information
philipr-za authored Mar 31, 2022
1 parent 60371a0 commit b5797b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions applications/daily_tests/automatic_recovery_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down

0 comments on commit b5797b7

Please sign in to comment.