mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Duplicate remover: updating savedQuestions.json
This commit is contained in:
parent
a2bde65425
commit
18b832ca59
1 changed files with 22 additions and 0 deletions
|
@ -160,6 +160,15 @@ function removePossibleAnswersDuplicates(path) {
|
|||
printProgressBar(currIndex, count)
|
||||
})
|
||||
|
||||
log(`${C('green')}Updating savedQuestions.json ...${C()}`)
|
||||
count = dirs.length
|
||||
currIndex = 0
|
||||
dirs.forEach((dir) => {
|
||||
currIndex++
|
||||
updateSavedQuestionsFile(path + '/' + dir)
|
||||
printProgressBar(currIndex, count)
|
||||
})
|
||||
|
||||
log(
|
||||
`Deleted ${C('green')}${delets}${C()} files, and ${C(
|
||||
'green'
|
||||
|
@ -199,6 +208,19 @@ function clearPossibleAnswers(path, db) {
|
|||
log(`Deleted ${C('green')}${delets}${C()} files`)
|
||||
}
|
||||
|
||||
function updateSavedQuestionsFile(path) {
|
||||
const filePath = path + '/' + 'savedQuestions.json'
|
||||
if (!utils.FileExists(filePath)) {
|
||||
log(`${filePath} does not exists!`)
|
||||
return
|
||||
}
|
||||
|
||||
const savedQuestions = utils.ReadJSON(filePath)
|
||||
return savedQuestions.filter((sq) => {
|
||||
return utils.FileExists(path + '/' + sq.fname)
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// difference
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue