forked from MapComplete/MapComplete
		
	Fix: multianswer would not accept last option
This commit is contained in:
		
							parent
							
								
									138b2ada2f
								
							
						
					
					
						commit
						6f5c71ed5a
					
				
					 2 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -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 {
 | 
					        } else {
 | 
				
			||||||
            // Is at least one mapping shown in the answer?
 | 
					            // Is at least one mapping shown in the answer?
 | 
				
			||||||
            const someMappingIsShown = this.mappings.some(m => {
 | 
					            const someMappingIsShown = this.mappings.some(m => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@
 | 
				
			||||||
        // We received a new config -> reinit
 | 
					        // We received a new config -> reinit
 | 
				
			||||||
        unit = layer.units.find(unit => unit.appliesToKeys.has(config.freeform?.key))
 | 
					        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*/];
 | 
					            checkedMappings = [...config.mappings.map(_ => false), false /*One element extra in case a freeform value is added*/];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (config.freeform?.key) {
 | 
					        if (config.freeform?.key) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue