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)