forked from MapComplete/MapComplete
		
	Fix: fix postfixdistinguished-charge input
This commit is contained in:
		
							parent
							
								
									c6d1ee64d8
								
							
						
					
					
						commit
						70ad2431d0
					
				
					 2 changed files with 10 additions and 5 deletions
				
			
		|  | @ -746,12 +746,14 @@ export default class TagRenderingConfig { | |||
|         if (freeformValue === "") { | ||||
|             freeformValue = undefined | ||||
|         } | ||||
|         if (this.freeform?.postfixDistinguished) { | ||||
|             const allValues = currentProperties[this.freeform.key].split(";").map((s) => s.trim()) | ||||
|         const pf = this.freeform?.postfixDistinguished | ||||
|         if (pf) { | ||||
|             const v = currentProperties[this.freeform.key] ?? "" | ||||
|             const allValues = v.split(";").map((s) => s.trim()) | ||||
|             const perPostfix: Record<string, string> = {} | ||||
|             for (const value of allValues) { | ||||
|                 const [v, postfix] = value.split("/") | ||||
|                 perPostfix[postfix.trim()] = v.trim() | ||||
|                 const [v, postfix] = value.split("/").map(s => s.trim()) | ||||
|                 perPostfix[postfix ?? pf] = v.trim() | ||||
|             } | ||||
|             if (freeformValue === "" || freeformValue === undefined) { | ||||
|                 delete perPostfix[this.freeform.postfixDistinguished] | ||||
|  | @ -1042,7 +1044,8 @@ export default class TagRenderingConfig { | |||
|      */ | ||||
|     public markUnknown(layer: LayerConfig, currentProperties: Record<string, string>): UploadableTag[] { | ||||
|         if (this.freeform?.postfixDistinguished) { | ||||
|             const allValues = currentProperties[this.freeform.key].split(";").filter( | ||||
|             const v = currentProperties[this.freeform.key] ?? "" | ||||
|             const allValues = v.split(";").filter( | ||||
|                 part => part.split("/")[1]?.trim() !== this.freeform.postfixDistinguished | ||||
|             ) | ||||
|             return [new Tag(this.freeform.key, allValues.join(";"))] | ||||
|  |  | |||
|  | @ -252,6 +252,8 @@ | |||
|       } else if (selectedTags instanceof And) { | ||||
|         // Add the extraTags to the existing And | ||||
|         selectedTags = [...TagTypes.uploadableAnd(selectedTags), ...extraTagsArray] | ||||
|       } else if (Array.isArray(selectedTags)) { | ||||
|         // pass | ||||
|       } else { | ||||
|         console.error( | ||||
|           "selectedTags is not of type Tag or And, it is a " + JSON.stringify(selectedTags) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue