mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
/q json response, searching with "" subj if there is no result
This commit is contained in:
parent
bf86b91172
commit
a1e99c53ae
3 changed files with 29 additions and 8 deletions
|
@ -62,7 +62,13 @@ function ProcessIncomingRequest (recievedData, qdb) {
|
|||
|
||||
d.quiz.forEach((question) => {
|
||||
let q = new classes.Question(question.Q, question.A, question.data)
|
||||
let sames = qdb.Search(q, '') // TODO d.subj
|
||||
let sames = qdb.Search(q, d.subj)
|
||||
if (sames.length === 0) {
|
||||
sames = qdb.Search(q, d.subj)
|
||||
if (sames.length !== 0) {
|
||||
logger.Log(`\t'${d.subj}' gave no result but '' did! (adding new questions)`, logger.GetColor('redbg'))
|
||||
}
|
||||
}
|
||||
// if it didnt find any question, or every found questions match is lower thatn 80
|
||||
let isNew = sames.length === 0 || sames.every(searchResItem => {
|
||||
return searchResItem.match < classes.minMatchAmmount
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue