Fix: add support for 'alsoShowIf' in multiAnswers, fix https://github.com/pietervdvn/MapComplete/issues/2293

This commit is contained in:
Pieter Vander Vennet 2025-02-28 12:44:50 +01:00
parent 09b68633d9
commit cddf319c9e
3 changed files with 240 additions and 857 deletions

View file

@ -479,6 +479,9 @@ export default class TagRenderingConfig {
if (TagUtils.MatchesMultiAnswer(m.if, tags)) {
return true
}
if (m.alsoShowIf?.matchesProperties(tags)) {
return true
}
}
const free = this.freeform?.key
@ -522,14 +525,17 @@ export default class TagRenderingConfig {
then: TypedTranslation<Record<string, string>>
img?: string
}[] = Utils.NoNull(
(this.mappings ?? [])?.map((mapping) => {
(this.mappings ?? [])?.filter((mapping) => {
if (mapping.if === undefined) {
return mapping
return true
}
if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) {
return mapping
return true
}
return undefined
if (mapping.alsoShowIf?.matchesProperties(tags)) {
return true
}
return false
})
)