mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Fixed added questions beeing empty arrays, removed some consolelogs
This commit is contained in:
parent
6c781eba97
commit
661ceb1688
4 changed files with 7 additions and 14 deletions
1
devel/emptyData.json
Normal file
1
devel/emptyData.json
Normal file
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -2,11 +2,10 @@
|
|||
url=$(head -n 1 ../serverAddress)
|
||||
echo "Server url: $url"
|
||||
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "1 param required: json to send to localhost, got $#"
|
||||
else
|
||||
data=$(tr -d '\n' < "$1" | awk '$1=$1')
|
||||
data=$(tr -d '\n' <"$1" | awk '$1=$1')
|
||||
echo sending
|
||||
echo "SENT DATA:"
|
||||
../bin/hr.sh
|
||||
|
@ -14,4 +13,3 @@ else
|
|||
../bin/hr.sh
|
||||
curl -X POST --data "datatoadd=$data" "$url/isAdding"
|
||||
fi
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
|
|||
Promise.all(questionSearchPromises)
|
||||
.then((results) => {
|
||||
const allQuestions = [] // all new questions here that do not have result
|
||||
results.forEach((result) => {
|
||||
results.forEach((result, i) => {
|
||||
if (result.length === 0) {
|
||||
allQuestions.push(result)
|
||||
allQuestions.push(data.quiz[i])
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -149,12 +149,9 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
|
|||
logger.DebugLog(allQuestions, 'actions', 2)
|
||||
|
||||
logger.DebugLog('ProcessIncomingRequest done', 'actions', 1)
|
||||
resolve({
|
||||
newQuestions: allQLength.length,
|
||||
newDb: qdb,
|
||||
})
|
||||
resolve(allQuestions.length)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
logger.Log(
|
||||
'Error while processing processData worker result!',
|
||||
logger.GetColor('redbg')
|
||||
|
@ -172,7 +169,7 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
|
|||
console.error(err)
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
console.error(err)
|
||||
logger.Log('Couldnt parse JSON data', logger.GetColor('redbg'))
|
||||
reject(new Error('Couldnt parse JSON data'))
|
||||
}
|
||||
|
|
|
@ -124,8 +124,6 @@ function answerPreProcessor(value) {
|
|||
function removeAnswerLetters(value) {
|
||||
assert(value)
|
||||
|
||||
console.log(value)
|
||||
|
||||
let val = value.split('. ')
|
||||
if (val[0].length < 2 && val.length > 1) {
|
||||
val.shift()
|
||||
|
@ -382,7 +380,6 @@ function searchData(data, question, subjName, questionData) {
|
|||
logger.DebugLog('No subject name as param!', 'qdb search', 1)
|
||||
}
|
||||
question = simplifyQuestion(question)
|
||||
console.log('RESULT: ' + question)
|
||||
|
||||
const worker = new Worker(searchDataWorkerFile, {
|
||||
workerData: { data, subjName, question, questionData },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue