forked from MapComplete/MapComplete
		
	Add check for duplicate ids in layers, fix duplicates
This commit is contained in:
		
							parent
							
								
									4235c42463
								
							
						
					
					
						commit
						4f6f264445
					
				
					 2 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
					@ -455,6 +455,15 @@ export class ValidateLayer extends DesugaringStep<LayerConfigJson> {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // duplicate ids in tagrenderings check
 | 
				
			||||||
 | 
					          const duplicates = Utils.Dedup(Utils.Dupiclates( Utils.NoNull((json.tagRenderings ?? []).map(tr => tr["id"]))))
 | 
				
			||||||
 | 
					              .filter(dupl => dupl !== "questions")
 | 
				
			||||||
 | 
					            if(duplicates.length > 0){
 | 
				
			||||||
 | 
					                errors.push("At "+context+": some tagrenderings have a duplicate id: "+duplicates.join(", "))
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // Some checks for legacy elements
 | 
					                // Some checks for legacy elements
 | 
				
			||||||
| 
						 | 
					@ -472,7 +481,7 @@ export class ValidateLayer extends DesugaringStep<LayerConfigJson> {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // CHeck location of layer file
 | 
					                // Check location of layer file
 | 
				
			||||||
                const expected: string = `assets/layers/${json.id}/${json.id}.json`
 | 
					                const expected: string = `assets/layers/${json.id}/${json.id}.json`
 | 
				
			||||||
                if (this._path != undefined && this._path.indexOf(expected) < 0) {
 | 
					                if (this._path != undefined && this._path.indexOf(expected) < 0) {
 | 
				
			||||||
                    errors.push("Layer is in an incorrect place. The path is " + this._path + ", but expected " + expected)
 | 
					                    errors.push("Layer is in an incorrect place. The path is " + this._path + ", but expected " + expected)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@
 | 
				
			||||||
            "render": "{histogram(_embedded_cs:themes, Themename, Number of changesets)}"
 | 
					            "render": "{histogram(_embedded_cs:themes, Themename, Number of changesets)}"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            "id": "hist_themes",
 | 
					            "id": "hist_users",
 | 
				
			||||||
            "render": "{histogram(_embedded_cs:users, Contributor, Number of changesets)}"
 | 
					            "render": "{histogram(_embedded_cs:users, Contributor, Number of changesets)}"
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue