fix this reference to sort method

This commit is contained in:
Kyle Spearrin 2017-08-30 08:43:06 -04:00
parent ae6c609c91
commit de097eaacf
1 changed files with 23 additions and 21 deletions

View File

@ -497,7 +497,28 @@ function initLoginService() {
return deferred.promise;
};
LoginService.prototype.sortLoginsByLastUsed = function (a, b) {
LoginService.prototype.sortLoginsByLastUsed = sortLoginsByLastUsed;
LoginService.prototype.sortLoginsByLastUsedThenName = function (a, b) {
var result = sortLoginsByLastUsed(a, b);
if (result !== 0) {
return result;
}
var nameA = (a.name + '_' + a.username).toUpperCase();
var nameB = (b.name + '_' + b.username).toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
};
function sortLoginsByLastUsed(a ,b) {
var aLastUsed = a.localData && a.localData.lastUsedDate ? a.localData.lastUsedDate : null;
var bLastUsed = b.localData && b.localData.lastUsedDate ? b.localData.lastUsedDate : null;
@ -516,26 +537,7 @@ function initLoginService() {
}
return 0;
};
LoginService.prototype.sortLoginsByLastUsedThenName = function (a, b) {
var result = this.sortLoginsByLastUsed(a, b);
if (result !== 0) {
return result;
}
var nameA = (a.name + '_' + a.username).toUpperCase();
var nameB = (b.name + '_' + b.username).toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
};
}
function handleError(error, deferred) {
deferred.reject(error);