new db update fix

This commit is contained in:
mrfry 2021-02-07 21:15:19 +01:00
parent ce573a63ab
commit 002865ed4a
3 changed files with 22 additions and 13 deletions

View file

@ -278,8 +278,16 @@ function isQuestionValid(question: Question) {
return true
}
export function shouldSearchDataFile(df: DataFile, testUrl: string): Boolean {
if (typeof df.shouldSearch === 'string' && df.shouldSearch === 'always') {
export function shouldSearchDataFile(
df: DataFile,
testUrl: string,
trueIfAlways?: Boolean
): Boolean {
if (
typeof df.shouldSearch === 'string' &&
df.shouldSearch === 'always' &&
trueIfAlways
) {
return true
}
@ -329,7 +337,7 @@ export function loadJSON(
dataDir: string
): Array<QuestionDb> {
return dataFiles.reduce((acc, dataFile, index) => {
const dataPath = dataDir + '/' + dataFile.path
const dataPath = dataDir + dataFile.path
if (!utils.FileExists(dataPath)) {
utils.WriteFile(JSON.stringify([]), dataPath)