From 60d43c5247baf5231608166f9387d6e066cf6531 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Fri, 28 Sep 2018 12:48:19 +0300 Subject: [PATCH] [WebUI] History: add sorting by symbol score value --- interface/index.html | 3 ++- interface/js/app/history.js | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/interface/index.html b/interface/index.html index 6eebef1d4..1cf363b96 100644 --- a/interface/index.html +++ b/interface/index.html @@ -291,7 +291,8 @@
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index f82925b26..3d1983b23 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -113,7 +113,7 @@ define(["jquery", "footable", "humanize"], } function process_history_v2(data) { - // Display no more than rcpt_lim recipients + // Display no more than rcpt_lim recipients var rcpt_lim = 3; var items = []; @@ -121,13 +121,23 @@ define(["jquery", "footable", "humanize"], var e = document.getElementById(id); return e.options[e.selectedIndex].value; } - var compare = (getSelector("selSymOrder") === "score") - ? function (e1, e2) { - return Math.abs(e2.score) - Math.abs(e1.score); - } - : function (e1, e2) { - return e1.name.localeCompare(e2.name); - }; + var compare = null; + switch (getSelector("selSymOrder")) { + case "score": + compare = function (e1, e2) { + return e2.score - e1.score; + }; + break; + case "name": + compare = function (e1, e2) { + return e1.name.localeCompare(e2.name); + }; + break; + default: + compare = function (e1, e2) { + return Math.abs(e2.score) - Math.abs(e1.score); + }; + } $("#selSymOrder, label[for='selSymOrder']").show(); -- 2.39.5