From 0fd54879f3fa2c6443dc68efc861a51bc75de956 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Mon, 25 Apr 2016 01:21:27 +0300 Subject: [PATCH] fix 'finite number' bug, fix fiatBalance bug --- lib/notifier.js | 7 +++++-- lib/plugins.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/notifier.js b/lib/notifier.js index 12da5eea..faa6df7e 100644 --- a/lib/notifier.js +++ b/lib/notifier.js @@ -133,8 +133,11 @@ function formatCurrency (num, code) { function emailAlert (alert) { switch (alert.code) { case 'ping': - var pingAge = prettyMs(alert.age, {compact: true, verbose: true}) - return 'Connection to machine down for ' + pingAge + if (alert.age) { + var pingAge = prettyMs(alert.age, {compact: true, verbose: true}) + return 'Connection to machine down for ' + pingAge + } + return 'Machine down for a while or never connected' case 'stale': var stuckAge = prettyMs(alert.age, {compact: true, verbose: true}) return 'Machine is stuck on ' + alert.state + 'screen for ' + stuckAge diff --git a/lib/plugins.js b/lib/plugins.js index 4aab69ae..bb3773a5 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -442,7 +442,7 @@ exports.fiatBalance = function fiatBalance (cryptoCode) { var unitScale = new BigNumber(10).pow(coins[cryptoCode].unitScale) var fiatTransferBalance = lastBalance.div(unitScale).times(rate).div(lowBalanceMargin) - return fiatTransferBalance + return fiatTransferBalance.toFixed(3) } /*