mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Sorting fix
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user