Remove filter noFractionNumber from views. Fix conversionRate from send.

This commit is contained in:
Gustavo Maximiliano Cortez 2014-11-30 18:28:55 -03:00 committed by Matias Alejo Garcia
commit c215b3c15e
5 changed files with 23 additions and 17 deletions

View file

@ -2,7 +2,7 @@
var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('HistoryController',
function($scope, $rootScope) {
function($scope, $rootScope, $filter) {
var w = $rootScope.wallet;
$rootScope.title = 'History';
@ -138,6 +138,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
_.each(items, function(tx) {
tx.ts = tx.minedTs || tx.sentTs;
tx.rateTs = Math.floor((tx.ts || now) / 1000);
tx.amount = $filter('noFractionNumber')(tx.amount);
});
var index = _.indexBy(items, 'rateTs');
@ -145,7 +146,8 @@ angular.module('copayApp.controllers').controller('HistoryController',
if (!err && res) {
_.each(res, function(r) {
var tx = index[r.ts];
tx.alternativeAmount = r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null;
tx.alternativeAmount = $filter('noFractionNumber')(
(r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null);
});
setTimeout(function() {
$scope.$digest();
@ -153,13 +155,10 @@ angular.module('copayApp.controllers').controller('HistoryController',
}
});
$scope.blockchain_txs = w.cached_txs = items;
$scope.nbPages = res.nbPages;
$scope.totalItems = res.nbItems;
$scope.loading = false;
setTimeout(function() {
$scope.$digest();

View file

@ -3,7 +3,7 @@ var bitcore = require('bitcore');
var preconditions = require('preconditions').singleton();
angular.module('copayApp.controllers').controller('SendController',
function($scope, $rootScope, $window, $timeout, $modal, isMobile, notification, rateService) {
function($scope, $rootScope, $window, $timeout, $modal, $filter, isMobile, notification, rateService) {
var w = $rootScope.wallet;
preconditions.checkState(w);
preconditions.checkState(w.settings.unitToSatoshi);
@ -53,6 +53,11 @@ angular.module('copayApp.controllers').controller('SendController',
var domain = /^(?:https?)?:\/\/([^\/:]+).*$/.exec(url)[1];
tx.merchant.domain = domain;
}
if (tx.outs) {
_.each(tx.outs, function(out) {
out.value = $filter('noFractionNumber')(out.value);
});
}
});
$scope.txps = res.txs;
};
@ -115,7 +120,9 @@ angular.module('copayApp.controllers').controller('SendController',
var pp = $rootScope.pendingPayment;
$scope.address = pp.address + '';
var amount = pp.data.amount / w.settings.unitToSatoshi * 100000000;
$scope.amount = amount;
$scope.amount = $filter('noFractionNumber')(amount);
var alternativeAmount = rateService.toFiat((amount + defaultFee) * unitToSatoshi, alternativeIsoCode);
$scope.alternativeAmountPayPro = $filter('noFractionNumber')(alternativeAmount, 2);
$scope.commentText = pp.data.message;
}