From 061633bf6725422bfb3f35bf3fdb17b514669357 Mon Sep 17 00:00:00 2001 From: Aust Date: Mon, 18 Jul 2016 09:54:06 -0600 Subject: Make zero balance display 0. Fixes #449 --- ui/app/util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/util.js b/ui/app/util.js index a08006077..4655d63dc 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -123,7 +123,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) { var shortBalance = shortenBalance(balance, decimalsToKeep) if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { - balance = '<1.0e-5' + if (afterDecimal == 0) { + balance = '0' + } else { + balance = '<1.0e-5' + } } else if (beforeDecimal !== '0') { balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}` } -- cgit From c1859a24eefd0bd8b1717d148e6f566df0007f31 Mon Sep 17 00:00:00 2001 From: Aust Date: Mon, 18 Jul 2016 10:38:27 -0600 Subject: Add eslint config to pass tests --- ui/app/util.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui') diff --git a/ui/app/util.js b/ui/app/util.js index 4655d63dc..04ebcecdb 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -123,6 +123,7 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) { var shortBalance = shortenBalance(balance, decimalsToKeep) if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { + // eslint-disable-next-line eqeqeq if (afterDecimal == 0) { balance = '0' } else { -- cgit From 2fc27314796427f4a3d9bfadf77dc1b0d6f317d4 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 18 Jul 2016 11:47:27 -0700 Subject: Remove unused None string. --- ui/app/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/util.js b/ui/app/util.js index 04ebcecdb..84680fd06 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -96,7 +96,7 @@ function formatBalance (balance, decimalsToKeep) { var parsed = parseBalance(balance) var beforeDecimal = parsed[0] var afterDecimal = parsed[1] - var formatted = 'None' + var formatted if (decimalsToKeep === undefined) { if (beforeDecimal === '0') { if (afterDecimal !== '0') { -- cgit From 96cd087c9756ba8c9824af835c87c5a2a6512fee Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 18 Jul 2016 12:06:27 -0700 Subject: Readd string to conform to tests. Will discuss later. --- ui/app/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/util.js b/ui/app/util.js index 84680fd06..04ebcecdb 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -96,7 +96,7 @@ function formatBalance (balance, decimalsToKeep) { var parsed = parseBalance(balance) var beforeDecimal = parsed[0] var afterDecimal = parsed[1] - var formatted + var formatted = 'None' if (decimalsToKeep === undefined) { if (beforeDecimal === '0') { if (afterDecimal !== '0') { -- cgit