From 4fa62b0e4e47729ff323aee36c0e2a56ccfd99de Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 17 Jul 2015 14:43:40 -0300 Subject: [PATCH] handle moved + fee --- src/js/controllers/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index b737b38fb..dc6d91985 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -645,8 +645,20 @@ angular.module('copayApp.controllers').controller('indexController', function($r var _amount, _note; var dataString; data.forEach(function(it, index) { - _amount = (it.action == 'sent' ? '-' : '') + (it.amount * satToBtc).toFixed(8); - _note = formatString((it.message ? 'Note: ' + it.message + ' - ' : '') + 'TxId: ' + it.txid); + var amount = it.amount; + + if (it.action == 'moved') + amount = 0; + + if (it.action == 'sent' || it.action=='moved') + amount += it.fees; + + _amount = (it.action == 'sent' ? '-' : '') + (amount * satToBtc).toFixed(8); + _note = formatString((it.message ? 'Note: ' + it.message + ' - ' : '') + 'TxId: ' + it.txid + ' Fee'+ (it.fees * satToBtc).toFixed(8)) ; + + if (it.action == 'moved') + _note += ' Moved:' + (it.amount * satToBtc).toFixed(8) + dataString = formatDate(it.time * 1000) + ',' + formatString(it.addressTo) + ',' + _note + ',' + _amount + ',BTC,,,,'; csvContent += index < data.length ? dataString + "\n" : dataString; });