forked from MapComplete/MapComplete
		
	Fix: units which used a 'string'-validator might not detect the actual denomination. They have now been forbidden and fixed
This commit is contained in:
		
							parent
							
								
									143bf0bbda
								
							
						
					
					
						commit
						7b497f991d
					
				
					 4 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
					@ -2403,7 +2403,8 @@
 | 
				
			||||||
        "de": "Wie lange darf man hier maximal parken?"
 | 
					        "de": "Wie lange darf man hier maximal parken?"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "freeform": {
 | 
					      "freeform": {
 | 
				
			||||||
        "key": "maxstay"
 | 
					        "key": "maxstay",
 | 
				
			||||||
 | 
					        "type": "pfloat"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "render": {
 | 
					      "render": {
 | 
				
			||||||
        "en": "One can stay at most <b>{canonical(maxstay)}</b>",
 | 
					        "en": "One can stay at most <b>{canonical(maxstay)}</b>",
 | 
				
			||||||
| 
						 | 
					@ -3329,4 +3330,4 @@
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "neededChangesets": 10
 | 
					    "neededChangesets": 10
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -564,7 +564,8 @@
 | 
				
			||||||
        "nl": "Hoelang mag een voertuig hier blijven staan?"
 | 
					        "nl": "Hoelang mag een voertuig hier blijven staan?"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "freeform": {
 | 
					      "freeform": {
 | 
				
			||||||
        "key": "maxstay"
 | 
					        "key": "maxstay",
 | 
				
			||||||
 | 
					        "type": "pfloat"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "render": {
 | 
					      "render": {
 | 
				
			||||||
        "en": "One can stay at most <b>{canonical(maxstay)}</b>",
 | 
					        "en": "One can stay at most <b>{canonical(maxstay)}</b>",
 | 
				
			||||||
| 
						 | 
					@ -1049,4 +1050,4 @@
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "neededChangesets": 10
 | 
					    "neededChangesets": 10
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -515,7 +515,8 @@
 | 
				
			||||||
        "cs": "Jaká je šířka těchto dveří/vchodu?"
 | 
					        "cs": "Jaká je šířka těchto dveří/vchodu?"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "freeform": {
 | 
					      "freeform": {
 | 
				
			||||||
        "key": "width"
 | 
					        "key": "width",
 | 
				
			||||||
 | 
					        "type": "pfloat"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,10 @@ export class Unit {
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
        this.quantity = quantity
 | 
					        this.quantity = quantity
 | 
				
			||||||
        this._validator = validator
 | 
					        this._validator = validator
 | 
				
			||||||
 | 
					        if(!inverted && ["string","text","key","icon","translation","fediverse","id"].indexOf(validator.name) >= 0){
 | 
				
			||||||
 | 
					            console.trace("Unit error")
 | 
				
			||||||
 | 
					            throw "Invalid unit configuration. The validator is of a forbidden type: "+validator.name+"; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: "+appliesToKeys.join("; ")
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        this.inverted = inverted
 | 
					        this.inverted = inverted
 | 
				
			||||||
        this.appliesToKeys = new Set(appliesToKeys)
 | 
					        this.appliesToKeys = new Set(appliesToKeys)
 | 
				
			||||||
        this.denominations = applicableDenominations
 | 
					        this.denominations = applicableDenominations
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue