Add sanity check on filters: every search field must be mentioned in the question now

This commit is contained in:
pietervdvn 2022-03-29 21:31:59 +02:00
parent bedc0eb690
commit 787f604df3

View file

@ -68,6 +68,15 @@ export default class FilterConfig {
}
})
for (const field of fields) {
question.OnEveryLanguage((txt, language) => {
if(txt.indexOf("{"+field.name+"}")<0){
throw "Error in filter with fields at "+context+".question."+language+": The question text should contain every field, but it doesn't contain `{"+field+"}`: "+txt
}
return txt
})
}
if(option.default){
if(defaultSelection === undefined){
defaultSelection = i;