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:
@@ -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])
|
||||
}
|
||||
})
|
||||
|
Submodule submodules/qmining-page updated: e21f281dc5...9aa0c111ce
Reference in New Issue
Block a user