Add more bicycle options to cycle rental; add deletion and images to cycle rental, fix #703

This commit is contained in:
pietervdvn 2022-03-14 20:45:17 +01:00
parent 2d356476df
commit b406d17b10
12 changed files with 182 additions and 114 deletions

View file

@ -366,29 +366,34 @@ export default class TagRenderingConfig {
// A flag to check that the freeform key isn't matched multiple times // A flag to check that the freeform key isn't matched multiple times
// If it is undefined, it is "used" already, or at least we don't have to check for it anymore // If it is undefined, it is "used" already, or at least we don't have to check for it anymore
let freeformKeyUsed = this.freeform?.key === undefined; let freeformKeyDefined = this.freeform?.key !== undefined;
let usedFreeformValues = new Set<string>()
// We run over all the mappings first, to check if the mapping matches // We run over all the mappings first, to check if the mapping matches
const applicableMappings: { then: Translation, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => { const applicableMappings: { then: Translation, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
if (mapping.if === undefined) { if (mapping.if === undefined) {
return mapping; return mapping;
} }
if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) { if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) {
if (!freeformKeyUsed) { if (freeformKeyDefined && mapping.if.isUsableAsAnswer()) {
if (mapping.if.usedKeys().indexOf(this.freeform.key) >= 0) { // THe freeform key is defined: what value does it use though?
// This mapping matches the freeform key - we mark the freeform key to be ignored! // We mark the value to see if we have any leftovers
freeformKeyUsed = true; const value = mapping.if.asChange({}).find(kv => kv.k === this.freeform.key).v
} usedFreeformValues.add(value)
} }
return mapping; return mapping;
} }
return undefined; return undefined;
})) }))
if(freeformKeyDefined && tags[this.freeform.key] !== undefined){
if (!freeformKeyUsed const freeformValues = tags[this.freeform.key].split(";")
&& tags[this.freeform.key] !== undefined) { const leftovers = freeformValues.filter(v => !usedFreeformValues.has(v))
applicableMappings.push({then: this.render}) for (const leftover of leftovers) {
applicableMappings.push({then: this.render.OnEveryLanguage(str =>
str.replace(new RegExp("{"+this.freeform.key+"}", "g"), leftover))})
}
} }
return applicableMappings return applicableMappings
} }

View file

@ -456,7 +456,7 @@ export default class TagRenderingQuestion extends Combine {
if (freeform.inline) { if (freeform.inline) {
inputTagsFilter.SetClass("w-16-imp") inputTagsFilter.SetClass("w-48-imp")
inputTagsFilter = new InputElementWrapper(inputTagsFilter, configuration.render, freeform.key, tags, state) inputTagsFilter = new InputElementWrapper(inputTagsFilter, configuration.render, freeform.key, tags, state)
inputTagsFilter.SetClass("block") inputTagsFilter.SetClass("block")

View file

@ -146,10 +146,11 @@
}, },
"render": { "render": {
"en": "{rental} is rented here", "en": "{rental} is rented here",
"nl": "{rental} wordt hier uitgeleend" "nl": "{rental} kunnen hier uitgeleend worden"
}, },
"freeform": { "freeform": {
"key": "rental" "key": "rental",
"inline": true
}, },
"multiAnswer": true, "multiAnswer": true,
"mappings": [ "mappings": [
@ -194,6 +195,13 @@
"en": "Tandem bicycles can be rented here", "en": "Tandem bicycles can be rented here",
"nl": "Tandems kunnen hier gehuurd worden" "nl": "Tandems kunnen hier gehuurd worden"
} }
},
{
"if": "rental=racebike",
"then": {
"en": "Race bicycles can be rented here",
"nl": "Wielerfietsen (sportfietsen) kunnen hier gehuurd worden"
}
} }
] ]
}, },
@ -222,7 +230,7 @@
"kid_bike", "kid_bike",
{ {
"en": "bikes for children", "en": "bikes for children",
"nl": "Kinderfietsen" "nl": "kinderfietsen"
} }
], ],
[ [
@ -249,7 +257,7 @@
[ [
"tandem_bicycle", "tandem_bicycle",
{ {
"en": "tandem bicycle", "en": "tandem",
"nl": "tandem" "nl": "tandem"
} }
] ]
@ -320,5 +328,33 @@
"render": "2" "render": "2"
} }
} }
] ],
"allowMove": {
"enableImproveAccuracy": true,
"enableRelocation": true
},
"deletion": {
"softDeletionTags": {
"and": ["disused:amenity=bicycle_rental", "bicycle_rental=", "rental="]
},
"neededChangesets": 10,
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}],
"nonDeleteMappings": [{
"if": {
"and": [
"service:bicycle:rental=no"
]
},
"then": {
"en": "This bicycle shop used to rent out bikes but doesn't rent out bikes anymore",
"nl": "Deze fietszaak verhuurde vroeger fietsen, maar nu niet meer"
}
}]
}
} }

View file

@ -199,7 +199,14 @@
"amenity=", "amenity=",
"disused:amenity:={amenity}" "disused:amenity:={amenity}"
] ]
} },
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
}, },
"allowMove": true, "allowMove": true,
"mapRendering": [ "mapRendering": [

View file

@ -671,7 +671,14 @@
"amenity=", "amenity=",
"disused:amenity:={amenity}" "disused:amenity:={amenity}"
] ]
} },
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
}, },
"allowMove": true, "allowMove": true,
"mapRendering": [ "mapRendering": [

View file

@ -356,7 +356,14 @@
"amenity=", "amenity=",
"disused:amenity:={amenity}" "disused:amenity:={amenity}"
] ]
} },
"extraDeleteReasons": [{
"explanation": {
"nl": "{title()} is permanent gestopt",
"en": "{title()} has closed down permanently"
},
"changesetMessage": "shop_closed"
}]
}, },
"allowMove": true, "allowMove": true,
"mapRendering": [ "mapRendering": [

View file

@ -1,16 +1,13 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"title": { "title": {
"en": "Changes made with MapComplete", "en": "Changes made with MapComplete"
"de": "Änderungen mit MapComplete"
}, },
"shortDescription": { "shortDescription": {
"en": "Shows changes made by MapComplete", "en": "Shows changes made by MapComplete"
"de": "Zeigt Änderungen, die von MapComplete vorgenommen wurden"
}, },
"description": { "description": {
"en": "This maps shows all the changes made with MapComplete", "en": "This maps shows all the changes made with MapComplete"
"de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen"
}, },
"maintainer": "", "maintainer": "",
"icon": "./assets/svg/logo.svg", "icon": "./assets/svg/logo.svg",
@ -25,8 +22,7 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"name": { "name": {
"en": "Changeset centers", "en": "Changeset centers"
"de": "Schwerpunkte von Änderungssätzen"
}, },
"minzoom": 0, "minzoom": 0,
"source": { "source": {
@ -40,41 +36,35 @@
], ],
"title": { "title": {
"render": { "render": {
"en": "Changeset for {theme}", "en": "Changeset for {theme}"
"de": "Änderungssatz für {theme}"
} }
}, },
"description": { "description": {
"en": "Shows all MapComplete changes", "en": "Shows all MapComplete changes"
"de": "Zeigt alle MapComplete-Änderungen"
}, },
"tagRenderings": [ "tagRenderings": [
{ {
"id": "render_id", "id": "render_id",
"render": { "render": {
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>", "en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
"de": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
} }
}, },
{ {
"id": "contributor", "id": "contributor",
"render": { "render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>", "en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
"de": "Geändert von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
} }
}, },
{ {
"id": "theme", "id": "theme",
"render": { "render": {
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>", "en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
"de": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
}, },
"mappings": [ "mappings": [
{ {
"if": "theme~http.*", "if": "theme~http.*",
"then": { "then": {
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>", "en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
"de": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
} }
} }
] ]
@ -338,8 +328,7 @@
} }
], ],
"question": { "question": {
"en": "Themename contains {search}", "en": "Themename contains {search}"
"de": "Themenname enthält {search}"
} }
} }
] ]
@ -355,8 +344,7 @@
} }
], ],
"question": { "question": {
"en": "Made by contributor {search}", "en": "Made by contributor {search}"
"de": "Erstellt von Mitwirkendem {search}"
} }
} }
] ]
@ -372,8 +360,7 @@
} }
], ],
"question": { "question": {
"en": "<b>Not</b> made by contributor {search}", "en": "<b>Not</b> made by contributor {search}"
"de": "<b> Nicht</b> erstellt von Mitwirkendem {search}"
} }
} }
] ]
@ -388,8 +375,7 @@
{ {
"id": "link_to_more", "id": "link_to_more",
"render": { "render": {
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>", "en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
"de": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
} }
}, },
{ {

View file

@ -1985,6 +1985,14 @@ a {
width: 4rem !important; width: 4rem !important;
} }
.w-32-imp {
width: 8rem !important;
}
.w-48-imp {
width: 12rem !important;
}
.link-underline a { .link-underline a {
-webkit-text-decoration: underline 1px var(--foreground-color); -webkit-text-decoration: underline 1px var(--foreground-color);
text-decoration: underline 1px var(--foreground-color); text-decoration: underline 1px var(--foreground-color);

View file

@ -223,6 +223,14 @@ a {
width: 4rem !important; width: 4rem !important;
} }
.w-32-imp {
width: 8rem !important;
}
.w-48-imp {
width: 12rem !important;
}
.link-underline a { .link-underline a {
text-decoration: underline 1px var(--foreground-color); text-decoration: underline 1px var(--foreground-color);
} }

View file

@ -418,6 +418,18 @@
} }
}, },
"bicycle_rental": { "bicycle_rental": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
},
"nonDeleteMappings": {
"0": {
"then": "This bicycle shop used to rent out bikes but doesn't rent out bikes anymore"
}
}
},
"description": "Bicycle rental stations", "description": "Bicycle rental stations",
"name": "Bicycle rental", "name": "Bicycle rental",
"presets": { "presets": {
@ -458,7 +470,7 @@
"1": "bicycle panniers" "1": "bicycle panniers"
}, },
"6": { "6": {
"1": "tandem bicycle" "1": "tandem"
} }
} }
} }
@ -1215,6 +1227,13 @@
} }
}, },
"cafe_pub": { "cafe_pub": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions", "description": "A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions",
"filter": { "filter": {
"0": { "0": {
@ -3149,6 +3168,13 @@
} }
}, },
"food": { "food": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A layer showing restaurants and fast-food amenities (with a special rendering for friteries)", "description": "A layer showing restaurants and fast-food amenities (with a special rendering for friteries)",
"filter": { "filter": {
"0": { "0": {
@ -4346,6 +4372,13 @@
} }
}, },
"shops": { "shops": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} has closed down permanently"
}
}
},
"description": "A shop", "description": "A shop",
"name": "Shop", "name": "Shop",
"presets": { "presets": {

View file

@ -418,6 +418,18 @@
} }
}, },
"bicycle_rental": { "bicycle_rental": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
},
"nonDeleteMappings": {
"0": {
"then": "Deze fietszaak verhuurde vroeger fietsen, maar nu niet meer"
}
}
},
"description": "Fietsverhuustations", "description": "Fietsverhuustations",
"name": "Fietsverhuur", "name": "Fietsverhuur",
"presets": { "presets": {
@ -446,7 +458,7 @@
"1": "elektrische fietsen" "1": "elektrische fietsen"
}, },
"2": { "2": {
"1": "Kinderfietsen" "1": "kinderfietsen"
}, },
"3": { "3": {
"1": "BMX-fietsen" "1": "BMX-fietsen"
@ -484,8 +496,8 @@
"then": "Tandems kunnen hier gehuurd worden" "then": "Tandems kunnen hier gehuurd worden"
} }
}, },
"question": "Wat voor soort fietsen en fietstoebehoren worden hier verhuurd?", "question": "Wat voor soort fietsen en fietstoebehren worden hier verhuurd?",
"render": "{rental} wordt hier uitgeleend" "render": "{rental} kunnen hier uitgeleend worden"
}, },
"bicycle_rental_type": { "bicycle_rental_type": {
"mappings": { "mappings": {
@ -1224,6 +1236,13 @@
} }
}, },
"cafe_pub": { "cafe_pub": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"description": "Een laag die kroegen en koffiehuizen toont waar je iets kunt drinken. De laag zal je enkele vragen stellen", "description": "Een laag die kroegen en koffiehuizen toont waar je iets kunt drinken. De laag zal je enkele vragen stellen",
"filter": { "filter": {
"0": { "0": {
@ -3101,6 +3120,13 @@
} }
}, },
"food": { "food": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"filter": { "filter": {
"0": { "0": {
"options": { "options": {
@ -4169,6 +4195,13 @@
} }
}, },
"shops": { "shops": {
"deletion": {
"extraDeleteReasons": {
"0": {
"explanation": "{title()} is permanent gestopt"
}
}
},
"description": "Een winkel", "description": "Een winkel",
"name": "Winkel", "name": "Winkel",
"presets": { "presets": {

View file

@ -968,68 +968,6 @@
"shortDescription": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen.", "shortDescription": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen.",
"title": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen." "title": "Hydranten, Feuerlöscher, Feuerwachen und Rettungswachen."
}, },
"mapcomplete-changes": {
"description": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
"layers": {
"0": {
"description": "Zeigt alle MapComplete-Änderungen",
"filter": {
"0": {
"options": {
"0": {
"question": "Themenname enthält {search}"
}
}
},
"1": {
"options": {
"0": {
"question": "Erstellt von Mitwirkendem {search}"
}
}
},
"2": {
"options": {
"0": {
"question": "<b> Nicht</b> erstellt von Mitwirkendem {search}"
}
}
}
},
"name": "Schwerpunkte von Änderungssätzen",
"tagRenderings": {
"contributor": {
"render": "Geändert von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
},
"render_id": {
"render": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
},
"theme": {
"mappings": {
"0": {
"then": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
}
},
"render": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
}
},
"title": {
"render": "Änderungssatz für {theme}"
}
},
"1": {
"override": {
"tagRenderings": {
"link_to_more": {
"render": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
}
}
}
}
},
"shortDescription": "Zeigt Änderungen, die von MapComplete vorgenommen wurden",
"title": "Änderungen mit MapComplete"
},
"maps": { "maps": {
"description": "Auf dieser Karte findest du alle Karten, die OpenStreetMap kennt - typischerweise eine große Karte auf einer Informationstafel, die das Gebiet, die Stadt oder die Region zeigt, z.B. eine touristische Karte auf der Rückseite einer Plakatwand, eine Karte eines Naturschutzgebietes, eine Karte der Radwegenetze in der Region, ...) <br/><br/>Wenn eine Karte fehlt, können Sie diese leicht auf OpenStreetMap kartieren.", "description": "Auf dieser Karte findest du alle Karten, die OpenStreetMap kennt - typischerweise eine große Karte auf einer Informationstafel, die das Gebiet, die Stadt oder die Region zeigt, z.B. eine touristische Karte auf der Rückseite einer Plakatwand, eine Karte eines Naturschutzgebietes, eine Karte der Radwegenetze in der Region, ...) <br/><br/>Wenn eine Karte fehlt, können Sie diese leicht auf OpenStreetMap kartieren.",
"shortDescription": "Dieses Thema zeigt alle (touristischen) Karten, die OpenStreetMap kennt", "shortDescription": "Dieses Thema zeigt alle (touristischen) Karten, die OpenStreetMap kennt",