save coincidences
This commit is contained in:
parent
6ff92555bc
commit
25760870f1
1 changed files with 13 additions and 7 deletions
|
|
@ -950,7 +950,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
function filter(search) {
|
function filter(search) {
|
||||||
self.result = [];
|
self.result = [];
|
||||||
function formatDate(date) {
|
|
||||||
|
function computeSearchableString(tx){
|
||||||
|
var addrbook = '';
|
||||||
|
if(self.addressbook[tx.addressTo]!= 'undefined') addrbook = self.addressbook[tx.addressTo] || '';
|
||||||
|
var searchableDate = computeSearchableDate(new Date(tx.time * 1000));
|
||||||
|
var message = tx.message ? tx.message : '';
|
||||||
|
var addressTo = tx.addressTo ? tx.addressTo : '';
|
||||||
|
return ((tx.amountStr+message+addressTo+addrbook+searchableDate).toString()).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function computeSearchableDate(date) {
|
||||||
var day = ('0' + date.getDate()).slice(-2).toString();
|
var day = ('0' + date.getDate()).slice(-2).toString();
|
||||||
var month = ('0' + (date.getMonth() + 1)).slice(-2).toString();
|
var month = ('0' + (date.getMonth() + 1)).slice(-2).toString();
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
|
|
@ -961,13 +971,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.historyShowMore = false;
|
self.historyShowMore = false;
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.result = lodash.filter(self.completeHistory, function(tx) {
|
self.result = lodash.filter(self.completeHistory, function(tx) {
|
||||||
return lodash.includes(tx.amountStr, search) ||
|
if (!tx.searcheableString) tx.searcheableString = computeSearchableString(tx);
|
||||||
lodash.includes(tx.message, search) ||
|
return lodash.includes(tx.searcheableString, search.toLowerCase());
|
||||||
lodash.includes(self.addressbook ? self.addressbook[tx.addressTo] : null, search) ||
|
|
||||||
lodash.includes(tx.addressTo, search) ||
|
|
||||||
lodash.isEqual(formatDate(new Date(tx.time * 1000)), search);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.result.length > self.historyShowLimit) self.historyShowMore = true;
|
if (self.result.length > self.historyShowLimit) self.historyShowMore = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue