Merge pull request #51 from sonatagreen/show-debits
show negative transactions
This commit is contained in:
commit
9527d1abc0
1 changed files with 3 additions and 5 deletions
|
@ -120,22 +120,20 @@ var TransactionList = React.createClass({
|
||||||
} else {
|
} else {
|
||||||
var transactionItems = [],
|
var transactionItems = [],
|
||||||
condensedTransactions = {};
|
condensedTransactions = {};
|
||||||
|
|
||||||
results.forEach(function(tx) {
|
results.forEach(function(tx) {
|
||||||
var txid = tx["txid"];
|
var txid = tx["txid"];
|
||||||
if (!(txid in condensedTransactions)) {
|
if (!(txid in condensedTransactions)) {
|
||||||
condensedTransactions[txid] = 0;
|
condensedTransactions[txid] = 0;
|
||||||
}
|
}
|
||||||
condensedTransactions[txid] += parseFloat(tx["value"]);
|
condensedTransactions[txid] += parseFloat(tx["amount"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
results.reverse().forEach(function(tx) {
|
results.reverse().forEach(function(tx) {
|
||||||
var txid = tx["txid"];
|
var txid = tx["txid"];
|
||||||
if (condensedTransactions[txid] && condensedTransactions[txid] > 0)
|
if (condensedTransactions[txid] && condensedTransactions[txid] != 0)
|
||||||
{
|
{
|
||||||
transactionItems.push({
|
transactionItems.push({
|
||||||
id: txid,
|
id: txid,
|
||||||
date: new Date(parseInt(tx["timestamp"]) * 1000),
|
date: new Date(parseInt(tx["time"]) * 1000),
|
||||||
amount: condensedTransactions[txid]
|
amount: condensedTransactions[txid]
|
||||||
});
|
});
|
||||||
delete condensedTransactions[txid];
|
delete condensedTransactions[txid];
|
||||||
|
|
Loading…
Reference in a new issue