diff --git a/Docs/Tools/stats/stats.2020-8.json b/Docs/Tools/stats/stats.2020-8.json deleted file mode 100644 index fbfbb3f72..000000000 --- a/Docs/Tools/stats/stats.2020-8.json +++ /dev/null @@ -1 +0,0 @@ -{"features":[]} \ No newline at end of file diff --git a/UI/StatisticsGUI.ts b/UI/StatisticsGUI.ts index db4077cd8..bd05a90b5 100644 --- a/UI/StatisticsGUI.ts +++ b/UI/StatisticsGUI.ts @@ -106,6 +106,9 @@ class StatisticsForOverviewFile extends Combine { console.log("All keys:", allKeys) const valuesToSum = [ + "create", + "modify", + "delete", "answer", "move", "deletion", @@ -117,11 +120,18 @@ class StatisticsForOverviewFile extends Combine { "soft-delete"] + const excludedThemes = new Set() + excludedThemes.add("grb") + excludedThemes.add("etymology") + const summedValues = valuesToSum + .map(key => [key, overview.sum(key, excludedThemes)]) + .filter(kv => kv[1] != 0) + .map(kv => kv.join(": ")) const elements: BaseUIElement[] = [ - new Title("General statistics"), + new Title("General statistics (excluding etymology- and GRB-theme changes)"), new Combine([ overview._meta.length + " changesets match the filters", - new List(valuesToSum.map(key => key + ": " + overview.sum(key))) + new List(summedValues) ]).SetClass("flex flex-col border rounded-xl"), new Title("Breakdown") @@ -228,10 +238,13 @@ class ChangesetsOverview { return new ChangesetsOverview(this._meta.filter(predicate)) } - public sum(key: string): number { + public sum(key: string, excludeThemes: Set): number { let s = 0 for (const feature of this._meta) { - const parsed = Number(feature[key]) + if(excludeThemes.has(feature.properties.theme)){ + continue + } + const parsed = Number(feature.properties[key]) if (!isNaN(parsed)) { s += parsed } diff --git a/test.ts b/test.ts index e69de29bb..4126eb604 100644 --- a/test.ts +++ b/test.ts @@ -0,0 +1,3 @@ +import StatisticsGUI from "./UI/StatisticsGUI"; + +new StatisticsGUI().AttachTo("maindiv")