forked from MapComplete/MapComplete
Fix(inspector): graphs show up now
This commit is contained in:
parent
02b46e570a
commit
3614afb75e
1 changed files with 15 additions and 4 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
import { OsmObject } from "../../Logic/Osm/OsmObject"
|
import { OsmObject } from "../../Logic/Osm/OsmObject"
|
||||||
import Loading from "../Base/Loading.svelte"
|
import Loading from "../Base/Loading.svelte"
|
||||||
import { HistoryUtils } from "./HistoryUtils"
|
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 TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
||||||
import Tr from "../Base/Tr.svelte"
|
import Tr from "../Base/Tr.svelte"
|
||||||
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
|
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
import TagRenderingChart from "../BigComponents/TagRenderingChart"
|
import TagRenderingChart from "../BigComponents/TagRenderingChart"
|
||||||
import ToSvelte from "../Base/ToSvelte.svelte"
|
import ToSvelte from "../Base/ToSvelte.svelte"
|
||||||
import type { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson"
|
import type { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson"
|
||||||
|
import { Or } from "../../Logic/Tags/Or"
|
||||||
|
import { Utils } from "../../Utils"
|
||||||
|
|
||||||
export let onlyShowUsername: string[]
|
export let onlyShowUsername: string[]
|
||||||
export let features: Feature[]
|
export let features: Feature[]
|
||||||
|
|
@ -32,12 +34,21 @@
|
||||||
}[]
|
}[]
|
||||||
> = allHistories.mapD((histories) => HistoryUtils.fullHistoryDiff(histories, usernames))
|
> = 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(<TagRenderingConfigJson>tr)
|
(tr) => new TagRenderingConfig(<TagRenderingConfigJson>tr)
|
||||||
)
|
)
|
||||||
|
|
||||||
function detectQuestion(key: string): TagRenderingConfig {
|
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<
|
const mergedCount: Store<
|
||||||
|
|
@ -134,7 +145,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
Could not create a graph
|
Could not create a graph - this item type has no associated question
|
||||||
{/if}
|
{/if}
|
||||||
</AccordionSingle>
|
</AccordionSingle>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue