Chore: housekeeping

This commit is contained in:
Pieter Vander Vennet 2025-02-10 02:04:58 +01:00
parent cd9e03dd6f
commit b300fffdc5
156 changed files with 4436 additions and 1318 deletions

View file

@ -34,13 +34,15 @@
if (Array.isArray(r)) {
results.push(...r)
} else {
results.push(...r.features ?? [])
results.push(...(r.features ?? []))
}
}
return results
}
let allData = <UIEventSource<(ChangeSetData & OsmFeature)[]>>UIEventSource.FromPromise(downloadData())
let allData = <UIEventSource<(ChangeSetData & OsmFeature)[]>>(
UIEventSource.FromPromise(downloadData())
)
let overview: Store<ChangesetsOverview | undefined> = allData.mapD(
(data) =>
@ -64,10 +66,10 @@
function offerAsDownload() {
const data = GeoOperations.toCSV($overview._meta, {
ignoreTags: /^((deletion:node)|(import:node)|(move:node)|(soft-delete:))/
ignoreTags: /^((deletion:node)|(import:node)|(move:node)|(soft-delete:))/,
})
Utils.offerContentsAsDownloadableFile(data, "statistics.csv", {
mimetype: "text/csv"
mimetype: "text/csv",
})
}
</script>
@ -88,9 +90,9 @@
<Accordion>
{#each trs as tr}
<AccordionItem paddingDefault="p-0" inactiveClass="text-black">
<span slot="header" class={"w-full p-2 text-base"}>
{tr.question ?? tr.id}
</span>
<span slot="header" class={"w-full p-2 text-base"}>
{tr.question ?? tr.id}
</span>
<SingleStat {tr} overview={$overview} diffInDays={$diffInDays} />
</AccordionItem>
{/each}

View file

@ -5,18 +5,18 @@
import AllStats from "./AllStats.svelte"
import TitledPanel from "../Base/TitledPanel.svelte"
let homeUrl =
"https://data.mapcomplete.org/changeset-metadata/"
let homeUrl = "https://data.mapcomplete.org/changeset-metadata/"
let stats_files = "file-overview.json"
let indexFile = UIEventSource.FromPromise(Utils.downloadJson<string[]>(homeUrl + stats_files))
let prefix = /^stats.202[45]/
let filteredIndex = indexFile.mapD(index => index.filter(path => path.match(prefix)))
filteredIndex.addCallbackAndRunD(filtered => console.log("Filtered items are", filtered, indexFile.data))
let filteredIndex = indexFile.mapD((index) => index.filter((path) => path.match(prefix)))
filteredIndex.addCallbackAndRunD((filtered) =>
console.log("Filtered items are", filtered, indexFile.data)
)
</script>
<main class="h-screen">
<TitledPanel>
<div slot="title" class="flex w-full justify-between">
<span>Statistics of changes made with MapComplete</span>
@ -26,9 +26,7 @@
{#if $indexFile === undefined}
<Loading>Loading index file...</Loading>
{:else}
<AllStats
paths={$filteredIndex.map((p) => homeUrl + "/" + p)}
/>
<AllStats paths={$filteredIndex.map((p) => homeUrl + "/" + p)} />
{/if}
</TitledPanel>
</main>