diff --git a/src/standaloneUtils/rmDuplicates.js b/src/standaloneUtils/rmDuplicates.js index 25b51da..10cc92c 100644 --- a/src/standaloneUtils/rmDuplicates.js +++ b/src/standaloneUtils/rmDuplicates.js @@ -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 // ---------------------------------------------------------------------------------