remove data hack, display proposals honestly
This commit is contained in:
parent
d61ba54899
commit
d929e32949
3 changed files with 9 additions and 22 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
<span ng-show="!tx.merchant.pr.ca"><i class="fi-unlock"></i> {{tx.merchant.domain}}</span>
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="tx.outputs">
|
<span ng-if="tx.outputs">
|
||||||
<span>{{tx.outputs[0].summary.length}}</span>
|
<span>{{tx.outputs.recipientCount}}</span>
|
||||||
<span translate>recipients</span>
|
<span translate>recipients</span>
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="!tx.outputs">
|
<span ng-if="!tx.outputs">
|
||||||
|
|
|
||||||
|
|
@ -429,22 +429,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
var config = configService.getSync().wallet.settings;
|
var config = configService.getSync().wallet.settings;
|
||||||
self.pendingTxProposalsCountForUs = 0;
|
self.pendingTxProposalsCountForUs = 0;
|
||||||
lodash.each(txps, function(tx) {
|
lodash.each(txps, function(tx) {
|
||||||
// gregg hack test data
|
|
||||||
if (!tx.outputs) {
|
|
||||||
var maxCount = 5;
|
|
||||||
var notes = [ 'bitography.co', 'Chipotle @ Buckhead', 'Decentralus Maximus', 'Everyday Deals', 'FinTech Solutions'];
|
|
||||||
var addrs = [ '2MzCXF7QW4ArgiwDTh12qU3ymWNZzNsrbLo', '2N9JWQkJxbpbW6M4sVaz2Yvn4yczTZgZZh6', '2NFvpdtduhJzQaJcsx3Hf1oJ1U4ouUfLiFG'];
|
|
||||||
tx.outputs = [];
|
|
||||||
for (var i = 0; i < maxCount; i++) {
|
|
||||||
tx.outputs.push({
|
|
||||||
toAddress: addrs[Math.round(Math.random() * addrs.length) % addrs.length],
|
|
||||||
amount: 100 * Math.round(Math.random() * Math.pow(10, (i % 5) + 2)) + 1,
|
|
||||||
message: notes[Math.round(Math.random() * notes.length) % notes.length]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// gregg hack test data
|
|
||||||
|
|
||||||
function formatAmount(obj, amount) {
|
function formatAmount(obj, amount) {
|
||||||
obj.amountStr = profileService.formatAmount(obj.amount) + ' ' + config.unitName;
|
obj.amountStr = profileService.formatAmount(obj.amount) + ' ' + config.unitName;
|
||||||
obj.alternativeAmount = rateService.toFiat(obj.amount, config.alternativeIsoCode) ? rateService.toFiat(obj.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
|
obj.alternativeAmount = rateService.toFiat(obj.amount, config.alternativeIsoCode) ? rateService.toFiat(obj.amount, config.alternativeIsoCode).toFixed(2) : 'N/A';
|
||||||
|
|
@ -462,9 +446,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
formatAmount(o, o.amount * self.satToUnit);
|
formatAmount(o, o.amount * self.satToUnit);
|
||||||
return total + o.amount;
|
return total + o.amount;
|
||||||
}, 0);
|
}, 0);
|
||||||
var summary = lodash.sortBy(tx.outputs, function(o) {
|
var summary = lodash.sortBy(tx.outputs, 'amount').reverse();
|
||||||
return -1 * o.amount; // descending order
|
|
||||||
});
|
|
||||||
tx.outputs = [{
|
tx.outputs = [{
|
||||||
amount: tx.amount,
|
amount: tx.amount,
|
||||||
message: tx.message,
|
message: tx.message,
|
||||||
|
|
@ -473,6 +455,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
tx.outputs[0].parent = tx.outputs;
|
tx.outputs[0].parent = tx.outputs;
|
||||||
tx.outputs.transform = formatAmount;
|
tx.outputs.transform = formatAmount;
|
||||||
tx.outputs.accumulator = 'amount';
|
tx.outputs.accumulator = 'amount';
|
||||||
|
tx.outputs.recipientCount = summary.length;
|
||||||
formatAmount(tx.outputs[0], tx.amount * self.satToUnit);
|
formatAmount(tx.outputs[0], tx.amount * self.satToUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -372,8 +372,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
lastItem[list.accumulator] -= nextItem[list.accumulator];
|
lastItem[list.accumulator] -= nextItem[list.accumulator];
|
||||||
list.push(nextItem);
|
list.push(nextItem);
|
||||||
if (lastItem.summary.length) {
|
if (lastItem.summary.length) {
|
||||||
list.transform(lastItem, lastItem[list.accumulator]);
|
if (lastItem.summary.length === 1) {
|
||||||
list.push(lastItem);
|
list.push(lastItem.summary.pop());
|
||||||
|
} else {
|
||||||
|
list.transform(lastItem, lastItem[list.accumulator]);
|
||||||
|
list.push(lastItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue