Fix: multianswer would not accept last option

This commit is contained in:
Pieter Vander Vennet 2023-06-12 10:17:13 +02:00
parent 138b2ada2f
commit 6f5c71ed5a
2 changed files with 6 additions and 2 deletions

View file

@ -680,7 +680,11 @@ export default class TagRenderingConfig {
])
)
}
return TagUtils.FlattenMultiAnswer([...selectedMappings, ...unselectedMappings])
const and = TagUtils.FlattenMultiAnswer([...selectedMappings, ...unselectedMappings])
if(and.and.length === 0){
return undefined
}
return and
} else {
// Is at least one mapping shown in the answer?
const someMappingIsShown = this.mappings.some(m => {

View file

@ -46,7 +46,7 @@
// We received a new config -> reinit
unit = layer.units.find(unit => unit.appliesToKeys.has(config.freeform?.key))
if (config.mappings?.length > 0 && (checkedMappings === undefined || checkedMappings?.length < config.mappings.length)) {
if (config.mappings?.length > 0 && (checkedMappings === undefined || (checkedMappings?.length + 1) < config.mappings.length)) {
checkedMappings = [...config.mappings.map(_ => false), false /*One element extra in case a freeform value is added*/];
}
if (config.freeform?.key) {