From 268328b6febf44b5e1f1e3808dcc8915a5e4c9fe Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 24 Jun 2025 22:35:56 +0200 Subject: [PATCH] Themes(food): add whether a highchair is available, see #2447 --- assets/layers/filters/filters.json | 11 ++++ assets/layers/food/food.json | 2 + assets/layers/questions/baby_chair.svg | 23 ++++++++ .../layers/questions/baby_chair.svg.license | 2 + assets/layers/questions/license_info.json | 10 ++++ assets/layers/questions/questions.json | 53 +++++++++++++++++++ scripts/generateLayerOverview.ts | 4 +- .../ThemeConfig/Conversion/ExpandFilter.ts | 3 ++ 8 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 assets/layers/questions/baby_chair.svg create mode 100644 assets/layers/questions/baby_chair.svg.license diff --git a/assets/layers/filters/filters.json b/assets/layers/filters/filters.json index 43240d05df..f367b7893f 100644 --- a/assets/layers/filters/filters.json +++ b/assets/layers/filters/filters.json @@ -521,6 +521,17 @@ } } ] + }, + { + "id": "baby_highchair", + "options": [ + { + "question": { + "en": "Has a high chair for infants available" + }, + "osmTags": "highchair!=no" + } + ] } ], "allowMove": false diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index 794d913c26..d5ee5262d1 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -902,6 +902,7 @@ "cs": "

OtevĂ­racĂ­ hodiny drive-through

{opening_hours_table(opening_hours:drive_through)}" } }, + "child_highchair", { "question": { "nl": "Heeft deze eetgelegenheid een vegetarische optie?", @@ -1643,6 +1644,7 @@ } ] }, + "filters.baby_highchair", "filters.has_organic", "filters.sugar_free", "filters.gluten_free", diff --git a/assets/layers/questions/baby_chair.svg b/assets/layers/questions/baby_chair.svg new file mode 100644 index 0000000000..fcb1e3975d --- /dev/null +++ b/assets/layers/questions/baby_chair.svg @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/assets/layers/questions/baby_chair.svg.license b/assets/layers/questions/baby_chair.svg.license new file mode 100644 index 0000000000..47259a19ad --- /dev/null +++ b/assets/layers/questions/baby_chair.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: New Borns +SPDX-License-Identifier: CC0-1.0 \ No newline at end of file diff --git a/assets/layers/questions/license_info.json b/assets/layers/questions/license_info.json index fe402e0cdb..4dc7d44382 100644 --- a/assets/layers/questions/license_info.json +++ b/assets/layers/questions/license_info.json @@ -19,6 +19,16 @@ "https://commons.wikimedia.org/wiki/File:Noun_telecoil_audio_induction_hearing_loop_symbol_2011213.svg" ] }, + { + "path": "baby_chair.svg", + "license": "CC0-1.0", + "authors": [ + "New Borns" + ], + "sources": [ + "https://www.svgrepo.com/svg/35946/baby-chair-with-heart" + ] + }, { "path": "cash.svg", "license": "CC-BY-3.0", diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index 9e30fa170b..8be7bfd616 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -3629,6 +3629,59 @@ "freeform": { "key": "ref" } + }, + { + "id": "child_highchair", + "question": { + "en": "Is there a high chair (also known as booster chair) for toddlers available here?" + }, + "freeform": { + "key": "highchair", + "type": "nat" + }, + "render": { + "en": "{highchair} highchairs are available" + }, + "mappings": [ + { + "if": "highchair=no", + "alsoShowIf": "highchair=0", + "then": { + "en": "No highchair available" + } + }, + { + "if": "highchair=yes", + "icon": { + "path": "./assets/layers/questions/baby_chair.svg", + "class": "medium" + }, + "then": { + "en": "At least one high chair is available" + } + }, + { + "if": "highchair=1", + "icon": { + "path": "./assets/layers/questions/baby_chair.svg", + "class": "medium" + }, + "then": { + "en": "One high chair is available" + } + }, + { + "if": "highchair=2", + "icon": { + "path": "./assets/layers/questions/baby_chair.svg", + "class": "medium" + }, + "then": { + "en": "Two high chairs are available" + } + } + ], + "filters": ["filters.child_highchair"] } ], "allowMove": false, diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 85c47f4bf2..553b2e0ed1 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -207,7 +207,7 @@ class LayerBuilder extends Conversion> { } } - context = context.inOperation("building Layer " + id).enters("layer", id) + context = context.inOperation("building Layer " + id).enters("layer:", id) const config = this._layerConfigJsons.get(id) if (config.id !== id) { @@ -855,7 +855,7 @@ class LayerOverviewUtils extends Script { sharedQuestions ) builder.writeLayer(sharedQuestionsDef) - const allLayers = builder.convertStrict({}, ConversionContext.construct([], [])) + const allLayers = builder.convertStrict({}, ConversionContext.construct([], ["Building the layer index"])) if (layerState.get("usersettings") !== "clean") { // We always need the calculated tags of 'usersettings', so we export them separately if dirty diff --git a/src/Models/ThemeConfig/Conversion/ExpandFilter.ts b/src/Models/ThemeConfig/Conversion/ExpandFilter.ts index c01b72b1fe..cb74004e81 100644 --- a/src/Models/ThemeConfig/Conversion/ExpandFilter.ts +++ b/src/Models/ThemeConfig/Conversion/ExpandFilter.ts @@ -33,6 +33,9 @@ export class PruneFilters extends DesugaringStep { ): FilterConfigJson { if (filter.options.length === 1) { const option = filter.options[0] + if(!option.osmTags){ + context.err("Found a filter without osmTags. Did you forget to add them? The filter is:", JSON.stringify(option)) + } const tags = TagUtils.Tag(option.osmTags) const optimized = TagUtils.removeKnownParts(tags, sourceTags, true) if (optimized === true) {