forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
6122d2a42c
commit
a2bcfead15
22 changed files with 448 additions and 86 deletions
|
|
@ -32,7 +32,9 @@
|
|||
}[]
|
||||
> = allHistories.mapD((histories) => HistoryUtils.fullHistoryDiff(histories, usernames))
|
||||
|
||||
const trs = shared_questions.tagRenderings.map((tr) => new TagRenderingConfig(<TagRenderingConfigJson>tr))
|
||||
const trs = shared_questions.tagRenderings.map(
|
||||
(tr) => new TagRenderingConfig(<TagRenderingConfigJson>tr)
|
||||
)
|
||||
|
||||
function detectQuestion(key: string): TagRenderingConfig {
|
||||
return trs.find((tr) => tr.freeform?.key === key)
|
||||
|
|
@ -69,7 +71,7 @@
|
|||
keyCounts.forEach((values: Map<string, OsmObject[]>, key: string) => {
|
||||
const keyTotal: { value: string; features: Feature[] }[] = []
|
||||
values.forEach((count, value) => {
|
||||
keyTotal.push({ value, features: count.map(step => step.asGeoJson()) })
|
||||
keyTotal.push({ value, features: count.map((step) => step.asGeoJson()) })
|
||||
})
|
||||
let countForKey: Feature[] = []
|
||||
for (const { features } of keyTotal) {
|
||||
|
|
@ -78,10 +80,14 @@
|
|||
keyTotal.sort((a, b) => b.features.length - a.features.length)
|
||||
const tr = detectQuestion(key)
|
||||
perKey.push({
|
||||
count: countForKey.length, tr, key, values: keyTotal.map(({ value, features }) => ({
|
||||
count: countForKey.length,
|
||||
tr,
|
||||
key,
|
||||
values: keyTotal.map(({ value, features }) => ({
|
||||
value,
|
||||
count: features.length
|
||||
})), features: countForKey
|
||||
count: features.length,
|
||||
})),
|
||||
features: countForKey,
|
||||
})
|
||||
})
|
||||
perKey.sort((a, b) => b.count - a.count)
|
||||
|
|
@ -118,14 +124,13 @@
|
|||
{/each}
|
||||
</ul>
|
||||
{#if diff.tr}
|
||||
<div class="w-48 h-48">
|
||||
|
||||
<div class="h-48 w-48">
|
||||
<ToSvelte
|
||||
construct={new TagRenderingChart(diff.features, diff.tr, {
|
||||
groupToOtherCutoff: 0,
|
||||
chartType: "pie",
|
||||
sort: true,
|
||||
})}
|
||||
groupToOtherCutoff: 0,
|
||||
chartType: "pie",
|
||||
sort: true,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue