ask api changes, so it wont search unnecesary question dbs

This commit is contained in:
mrfry 2021-01-09 12:38:18 +01:00
parent 0463ab3cd2
commit b53fd84bf2
5 changed files with 116 additions and 65 deletions

View file

@ -263,6 +263,22 @@ function processIncomingRequestUsingDb(
})
}
export function shouldSearchDataFile(df: DataFile, testUrl: string): Boolean {
if (typeof df.shouldSearch === 'string' && df.shouldSearch === 'always') {
return true
}
if (typeof df.shouldSearch === 'object') {
if (df.shouldSearch.location) {
const { val } = df.shouldSearch.location
return testUrl.includes(val)
}
}
// FIXME: always return true if it gets here?
return true
}
export function shouldSaveDataFile(
df: DataFile,
recievedData: RecievedData