Added some logs, ask test script encodes JSON uri component

This commit is contained in:
mrfry 2020-10-15 10:50:02 +02:00
parent 1aa5c7eef4
commit 45962874fd
4 changed files with 9 additions and 2 deletions

View file

@ -23,6 +23,9 @@ elif [ "$#" -eq 2 ]; then
fi
../bin/hr.sh
data=$(node -e "console.log(encodeURIComponent('$data'));")
echo sending
echo "Question: $q"
echo "Data: $data"

View file

@ -170,7 +170,7 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
})
} catch (err) {
console.error(err)
logger.Log('Couldnt parse JSON data', logger.GetColor('redbg'))
logger.Log('There was en error handling incoming quiz data, see stderr', logger.GetColor('redbg'))
reject(new Error('Couldnt parse JSON data'))
}
})

View file

@ -297,6 +297,7 @@ function searchQuestion(subj, question, questionData, subjName) {
subj.Name,
questionData
)
if (percent.avg > minMatchAmmount) {
result.push({
q: currentQuestion,
@ -405,6 +406,8 @@ function searchData(data, question, subjName, questionData) {
})
worker.on('message', (result) => {
logger.DebugLog(`Worker message arrived`, 'worker', 2)
logger.DebugLog(result, 'worker', 3)
logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
logger.DebugLog(result, 'ask', 2)
@ -453,6 +456,7 @@ function dataToString(data) {
// ------------------------------------------------------------------------
if (!isMainThread) {
logger.DebugLog(`Starting search worker ...`, 'worker', 1)
const { data, subjName, question, questionData } = workerData
let result = []

@ -1 +1 @@
Subproject commit 6bc51fb3878564012ce7af1a75b7fa049ab5f3c5
Subproject commit 760dfb0c4ec005dbd496d772c7a5278cfa5071bc