diff --git a/scripts/GenerateSeries.ts b/scripts/GenerateSeries.ts index 9c7552d0b..af6bc06bb 100644 --- a/scripts/GenerateSeries.ts +++ b/scripts/GenerateSeries.ts @@ -105,8 +105,8 @@ class StatsDownloader { ): Promise { let page = 1 let allFeatures: ChangeSetData[] = [] - let endDay = new Date(year, month - 1 /* Zero-indexed: 0 = january*/, day + 1) - let endDate = `${endDay.getFullYear()}-${Utils.TwoDigits( + const endDay = new Date(year, month - 1 /* Zero-indexed: 0 = january*/, day + 1) + const endDate = `${endDay.getFullYear()}-${Utils.TwoDigits( endDay.getMonth() + 1 )}-${Utils.TwoDigits(endDay.getDate())}` let url = this.urlTemplate @@ -117,7 +117,7 @@ class StatsDownloader { .replace("{end_date}", endDate) .replace("{page}", "" + page) - let headers = { + const headers = { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0", "Accept-Language": "en-US,en;q=0.5", @@ -148,6 +148,9 @@ class StatsDownloader { allFeatures = Utils.NoNull(allFeatures) allFeatures.forEach((f) => { f.properties = { ...f.properties, ...f.properties.metadata } + if (f.properties.editor.toLowerCase().indexOf("android") >= 0) { + f.properties["android"] = "yes" + } delete f.properties.metadata f.properties["id"] = f.id }) @@ -212,8 +215,8 @@ class GenerateSeries extends Script { } private async downloadStatistics(targetDir: string) { - let year = 2020 - let month = 5 + let year = 2025 + let month = 1 let day = 1 if (!isNaN(Number(process.argv[2]))) { year = Number(process.argv[2]) diff --git a/src/UI/Statistics/AllStats.svelte b/src/UI/Statistics/AllStats.svelte index dfc099ab2..3ce16b9db 100644 --- a/src/UI/Statistics/AllStats.svelte +++ b/src/UI/Statistics/AllStats.svelte @@ -1,5 +1,5 @@ @@ -68,21 +77,28 @@ Loaded {downloaded} out of {paths.length} {:else} - Filters +
+ + Filters +
- - {#each trs as tr} - + {#if !$overview || $overview._meta.length === 0} +
Filter matches no items
+ {:else} + + {#each trs as tr} + {tr.question ?? tr.id} - - - {/each} - - + +
+ {/each} +
+ + {/if} {/if} diff --git a/src/UI/Statistics/ChangesetsOverview.ts b/src/UI/Statistics/ChangesetsOverview.ts index 0dde99b71..76966488f 100644 --- a/src/UI/Statistics/ChangesetsOverview.ts +++ b/src/UI/Statistics/ChangesetsOverview.ts @@ -1,6 +1,7 @@ import { Utils } from "../../Utils" import { Feature, Polygon } from "geojson" import { OsmFeature } from "../../Models/OsmFeature" + export interface ChangeSetData extends Feature { id: number type: "Feature" @@ -92,8 +93,12 @@ export class ChangesetsOverview { if (cs === undefined) { return undefined } + if (cs.properties.android) { + console.log("Found an ANDROID:", cs.properties) + } if (cs.properties.editor?.startsWith("iD")) { // We also fetch based on hashtag, so some edits with iD show up as well + // Sometimes, iD reuses a previous changeset, mimicking (!) mapcomplete accidentally return undefined } if (cs.properties.theme === undefined) { diff --git a/src/UI/Statistics/StatisticsGui.svelte b/src/UI/Statistics/StatisticsGui.svelte index 5417bb507..efcc2fc42 100644 --- a/src/UI/Statistics/StatisticsGui.svelte +++ b/src/UI/Statistics/StatisticsGui.svelte @@ -3,24 +3,32 @@ import { Utils } from "../../Utils" import Loading from "../Base/Loading.svelte" import AllStats from "./AllStats.svelte" + import TitledPanel from "../Base/TitledPanel.svelte" let homeUrl = "https://data.mapcomplete.org/changeset-metadata/" let stats_files = "file-overview.json" let indexFile = UIEventSource.FromPromise(Utils.downloadJson(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)) -
-
-

Statistics of changes made with MapComplete

- Back to index -
- {#if $indexFile === undefined} - Loading index file... - {:else} - p.startsWith("stats")).map((p) => homeUrl + "/" + p)} - /> - {/if} -
+
+ + +
+ Statistics of changes made with MapComplete +
+ Back to index + + {#if $indexFile === undefined} + Loading index file... + {:else} + homeUrl + "/" + p)} + /> + {/if} +
+