From e01f3fd40c7e181c701048ef62a1cfab973da792 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 29 Aug 2017 13:03:08 -0400 Subject: [PATCH] sort fixes when never used --- src/services/loginService.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/services/loginService.js b/src/services/loginService.js index 050c1dcd1d..d58d8aedfd 100644 --- a/src/services/loginService.js +++ b/src/services/loginService.js @@ -501,13 +501,20 @@ function initLoginService() { var aLastUsed = a.localData && a.localData.lastUsedDate ? a.localData.lastUsedDate : null; var bLastUsed = b.localData && b.localData.lastUsedDate ? b.localData.lastUsedDate : null; - if (aLastUsed && (!bLastUsed || aLastUsed < bLastUsed)) { + if (aLastUsed && bLastUsed && aLastUsed < bLastUsed) { return 1; } - if (bLastUsed && (!aLastUsed || aLastUsed > bLastUsed)) { + if (aLastUsed && !bLastUsed) { return -1; } + if (bLastUsed && aLastUsed && aLastUsed > bLastUsed) { + return -1; + } + if (bLastUsed && !aLastUsed) { + return 1; + } + return 0; };