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:
parent
3a7c3f0b54
commit
05eb044c52
1 changed files with 14 additions and 2 deletions
|
@ -300,7 +300,13 @@ function searchQuestion(subj, question, questionData, subjName) {
|
||||||
})
|
})
|
||||||
|
|
||||||
result = result.sort((q1, q2) => {
|
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
|
return result
|
||||||
|
@ -406,7 +412,13 @@ function searchData(data, question, subjName, questionData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
result = result.sort((q1, q2) => {
|
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)
|
debugLog(`QDB search result length: ${result.length}`, 'qdb search', 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue