mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
stricter subj name checking on question add, should log test fix
This commit is contained in:
parent
537f4c413e
commit
d962abfbc2
5 changed files with 144 additions and 51 deletions
|
@ -499,16 +499,17 @@ function addQuestion(
|
|||
logger.DebugLog(question, 'qdb add', 3)
|
||||
|
||||
const i = data.findIndex((subject) => {
|
||||
return subj
|
||||
.toLowerCase()
|
||||
.includes(getSubjNameWithoutYear(subject.Name).toLowerCase())
|
||||
return (
|
||||
subj.toLowerCase() ===
|
||||
getSubjNameWithoutYear(subject.Name).toLowerCase()
|
||||
)
|
||||
})
|
||||
|
||||
if (i !== -1) {
|
||||
logger.DebugLog('Adding new question to existing subject', 'qdb add', 1)
|
||||
data[i].Questions.push(question)
|
||||
} else {
|
||||
logger.DebugLog('Creating new subject for question', 'qdb add', 1)
|
||||
logger.Log(`Creating new subject: ${subj}`)
|
||||
data.push({
|
||||
Name: subj,
|
||||
Questions: [question],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue