From 05eb044c527218242942c727e40baacf9f5b9896 Mon Sep 17 00:00:00 2001 From: mrfry Date: Tue, 13 Oct 2020 19:35:27 +0200 Subject: [PATCH] Sorting fix --- src/utils/classes.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/utils/classes.js b/src/utils/classes.js index a5fb198..891b9c9 100755 --- a/src/utils/classes.js +++ b/src/utils/classes.js @@ -300,7 +300,13 @@ function searchQuestion(subj, question, questionData, subjName) { }) result = result.sort((q1, q2) => { - return q1.match < q2.match + if (q1.match < q2.match) { + return 1 + } else if (q1.match > q2.match) { + return -1 + } else { + return 0 + } }) return result @@ -406,7 +412,13 @@ function searchData(data, question, subjName, questionData) { } result = result.sort((q1, q2) => { - return q1.match < q2.match + if (q1.match < q2.match) { + return 1 + } else if (q1.match > q2.match) { + return -1 + } else { + return 0 + } }) debugLog(`QDB search result length: ${result.length}`, 'qdb search', 1)