mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Questions without cache in db fix
This commit is contained in:
parent
070defecb6
commit
2d81a76ef0
3 changed files with 17 additions and 11 deletions
|
@ -42,7 +42,11 @@ import {
|
|||
} from '../../utils/actions'
|
||||
import dbtools from '../../utils/dbtools'
|
||||
import auth from '../../middlewares/auth.middleware'
|
||||
import { dataToString, getSubjNameWithoutYear } from '../../utils/classes'
|
||||
import {
|
||||
dataToString,
|
||||
getSubjNameWithoutYear,
|
||||
createQuestion,
|
||||
} from '../../utils/classes'
|
||||
import {
|
||||
initWorkerPool,
|
||||
doALongTask,
|
||||
|
@ -1625,7 +1629,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
logger.Log(
|
||||
`User #${user.id} deleted '${file}' from subject '${subj}'`,
|
||||
logger.GetColor('cyanbg')
|
||||
logger.GetColor('cyan')
|
||||
)
|
||||
res.json({
|
||||
res: 'ok',
|
||||
|
@ -1710,7 +1714,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
logger.Log(
|
||||
`User #${user.id} deleted a question from '${subjName}'`,
|
||||
logger.GetColor('cyanbg')
|
||||
logger.GetColor('cyan')
|
||||
)
|
||||
utils.AppendToFile(
|
||||
`${date}: User ${user.id} deleted a question from '${subjName}' (index: ${index})`,
|
||||
|
@ -1770,7 +1774,7 @@ function GetApp(): ModuleType {
|
|||
Questions: subj.Questions.map((question, i) => {
|
||||
if (index === i) {
|
||||
oldVal = question
|
||||
return newVal
|
||||
return createQuestion(newVal)
|
||||
} else {
|
||||
return question
|
||||
}
|
||||
|
@ -1781,7 +1785,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
logger.Log(
|
||||
`User #${user.id} edited a question in '${subjName}'`,
|
||||
logger.GetColor('cyanbg')
|
||||
logger.GetColor('cyan')
|
||||
)
|
||||
utils.AppendToFile(
|
||||
`${date}: User ${user.id} edited a question in '${subjName}' (index: ${index})`,
|
||||
|
@ -1859,7 +1863,7 @@ function GetApp(): ModuleType {
|
|||
oldVal: question,
|
||||
newVal: changedTo.value,
|
||||
})
|
||||
return changedTo.value
|
||||
return createQuestion(changedTo.value)
|
||||
} else {
|
||||
return question
|
||||
}
|
||||
|
@ -1890,7 +1894,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
logger.Log(
|
||||
`User #${user.id} modified '${subjName}'. Edited: ${deletedQuestionsToWrite.length}, deleted: ${deletedQuestionsToWrite.length}`,
|
||||
logger.GetColor('cyanbg')
|
||||
logger.GetColor('cyan')
|
||||
)
|
||||
utils.AppendToFile(
|
||||
`${date} User #${user.id} modified '${subjName}'. Edited: ${deletedQuestionsToWrite.length}, deleted: ${deletedQuestionsToWrite.length}`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue