forked from MapComplete/MapComplete
		
	Allow different renderings in question mode, but emit a warning for this intead
This commit is contained in:
		
							parent
							
								
									07ee80a675
								
							
						
					
					
						commit
						3a3e2750f2
					
				
					 3 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@ import {Utils} from "../Utils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class Constants {
 | 
					export default class Constants {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static vNumber = "0.21.0";
 | 
					    public static vNumber = "0.22git .0";
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static ImgurApiKey = '7070e7167f0a25a'
 | 
					    public static ImgurApiKey = '7070e7167f0a25a'
 | 
				
			||||||
    public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"
 | 
					    public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -354,7 +354,9 @@ export class DetectShadowedMappings extends DesugaringStep<QuestionableTagRender
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            for (let j = 0; j < i; j++) {
 | 
					            for (let j = 0; j < i; j++) {
 | 
				
			||||||
                const doesMatch = parsedConditions[j].matchesProperties(properties)
 | 
					                const doesMatch = parsedConditions[j].matchesProperties(properties)
 | 
				
			||||||
                if (doesMatch) {
 | 
					                if(doesMatch && json.mappings[j].hideInAnswer === true && json.mappings[i].hideInAnswer !== true){
 | 
				
			||||||
 | 
					                    warnings.push(`At ${context}: Mapping ${i} is shadowed by mapping ${j}. However, mapping ${j} has 'hideInAnswer' set, which will result in a different rendering in question-mode.`)
 | 
				
			||||||
 | 
					                } else if (doesMatch) {
 | 
				
			||||||
                    // The current mapping is shadowed!
 | 
					                    // The current mapping is shadowed!
 | 
				
			||||||
                    errors.push(`At ${context}: Mapping ${i} is shadowed by mapping ${j} and will thus never be shown:
 | 
					                    errors.push(`At ${context}: Mapping ${i} is shadowed by mapping ${j} and will thus never be shown:
 | 
				
			||||||
    The mapping ${parsedConditions[i].asHumanString(false, false, {})} is fully matched by a previous mapping (namely ${j}), which matches:
 | 
					    The mapping ${parsedConditions[i].asHumanString(false, false, {})} is fully matched by a previous mapping (namely ${j}), which matches:
 | 
				
			||||||
| 
						 | 
					@ -362,6 +364,7 @@ export class DetectShadowedMappings extends DesugaringStep<QuestionableTagRender
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    To fix this problem, you can try to:
 | 
					    To fix this problem, you can try to:
 | 
				
			||||||
    - Move the shadowed mapping up
 | 
					    - Move the shadowed mapping up
 | 
				
			||||||
 | 
					    - Do you want to use a different text in 'question mode'? Add 'hideInAnswer=true' to the first mapping
 | 
				
			||||||
    - Use "addExtraTags": ["key=value", ...] in order to avoid a different rendering
 | 
					    - Use "addExtraTags": ["key=value", ...] in order to avoid a different rendering
 | 
				
			||||||
         (e.g. [{"if": "fee=no",                     "then": "Free to use", "hideInAnswer":true},
 | 
					         (e.g. [{"if": "fee=no",                     "then": "Free to use", "hideInAnswer":true},
 | 
				
			||||||
                {"if": {"and":["fee=no","charge="]}, "then": "Free to use"}]
 | 
					                {"if": {"and":["fee=no","charge="]}, "then": "Free to use"}]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -263,7 +263,9 @@
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "addr:unit",
 | 
					            "key": "addr:unit",
 | 
				
			||||||
            "placeholder": "Sub-unit (e.g. 1, Flat 2, Unit C)",
 | 
					            "placeholder": "Sub-unit (e.g. 1, Flat 2, Unit C)",
 | 
				
			||||||
            "addExtraTags": ["not:addr:unit="]
 | 
					            "addExtraTags": [
 | 
				
			||||||
 | 
					              "not:addr:unit="
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "mappings": [
 | 
					          "mappings": [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -544,7 +546,9 @@
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "addr:parentstreet",
 | 
					            "key": "addr:parentstreet",
 | 
				
			||||||
            "placeholder": "Other (please specify)",
 | 
					            "placeholder": "Other (please specify)",
 | 
				
			||||||
            "addExtraTags": ["not:addr:parentstreet="]
 | 
					            "addExtraTags": [
 | 
				
			||||||
 | 
					              "not:addr:parentstreet="
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "mappings": [
 | 
					          "mappings": [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue