mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Question adding fix
This commit is contained in:
parent
962581c5e7
commit
8e618f8457
2 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,7 @@ const utils = require('../utils/utils.js')
|
|||
const { addQuestion, getSubjNameWithoutYear } = require('./classes.js')
|
||||
// if a recievend question doesnt match at least this % to any other question in the db it gets
|
||||
// added to db
|
||||
const minMatchToAmmountToAdd = 90
|
||||
|
||||
const writeAfter = 1 // write after # of adds FIXME: set reasonable save rate
|
||||
var currWrites = 0
|
||||
|
@ -96,7 +97,10 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
|
|||
.then((results) => {
|
||||
const allQuestions = [] // all new questions here that do not have result
|
||||
results.forEach((result, i) => {
|
||||
if (result.length === 0) {
|
||||
let add = result.every((res) => {
|
||||
return res.match < minMatchToAmmountToAdd
|
||||
})
|
||||
if (add) {
|
||||
allQuestions.push(recievedQuestions[i])
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e21f281dc5301020de8c7f9dfe654281e36e9e5d
|
||||
Subproject commit 9aa0c111ce056d5309a8fc095ccb3745bc03f77f
|
Loading…
Add table
Add a link
Reference in a new issue