diff --git a/src/UI/History/AggregateView.svelte b/src/UI/History/AggregateView.svelte index 1c97d4fb1b..2f1a7b6154 100644 --- a/src/UI/History/AggregateView.svelte +++ b/src/UI/History/AggregateView.svelte @@ -5,7 +5,7 @@ import { OsmObject } from "../../Logic/Osm/OsmObject" import Loading from "../Base/Loading.svelte" import { HistoryUtils } from "./HistoryUtils" - import * as shared_questions from "../../../public/assets/generated/layers/questions.json" + import * as favourite from "../../../public/assets/generated/layers/favourite.json" import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" import Tr from "../Base/Tr.svelte" import AccordionSingle from "../Flowbite/AccordionSingle.svelte" @@ -13,6 +13,8 @@ import TagRenderingChart from "../BigComponents/TagRenderingChart" import ToSvelte from "../Base/ToSvelte.svelte" import type { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson" + import { Or } from "../../Logic/Tags/Or" + import { Utils } from "../../Utils" export let onlyShowUsername: string[] export let features: Feature[] @@ -32,12 +34,21 @@ }[] > = allHistories.mapD((histories) => HistoryUtils.fullHistoryDiff(histories, usernames)) - const trs = shared_questions.tagRenderings.map( + // We use the favourite-layer as it contains _all_ questions + const trs = favourite.tagRenderings.map( (tr) => new TagRenderingConfig(tr) ) function detectQuestion(key: string): TagRenderingConfig { - return trs.find((tr) => tr.freeform?.key === key) + const byKey = trs.find((tr) => tr.freeform?.key === key) + if (byKey) { + return byKey + } + return trs.find(tr => tr.mappings.some(mapping => { + const ifTags = Or.construct(Utils.NoNull([mapping.if, mapping.alsoShowIf])) + const keys = ifTags.usedKeys() + return keys.some(k => k == key) + })) } const mergedCount: Store< @@ -134,7 +145,7 @@ /> {:else} - Could not create a graph + Could not create a graph - this item type has no associated question {/if} {/each}