Performance: prepare dropping the NSI-logos from the repo

This commit is contained in:
Pieter Vander Vennet 2025-04-27 02:57:12 +02:00
parent 164b02c8ff
commit 555075edfe
3 changed files with 17 additions and 26 deletions

View file

@ -9,19 +9,8 @@ import { And } from "../src/Logic/Tags/And"
import Script from "./Script"
import NameSuggestionIndex from "../src/Logic/Web/NameSuggestionIndex"
import TagInfo from "../src/Logic/Web/TagInfo"
import { TagsFilter } from "../src/Logic/Tags/TagsFilter"
class Utilities {
static mapValues<X extends string | number, T, TOut>(
record: Record<X, T>,
f: (t: T) => TOut
): Record<X, TOut> {
const newR = <Record<X, TOut>>{}
for (const x in record) {
newR[x] = f(record[x])
}
return newR
}
}
class GenerateStats extends Script {
async createOptimizationFile(includeTags = true) {
@ -38,7 +27,7 @@ class GenerateStats extends Script {
continue
}
const sourcesList = [TagUtils.Tag(layer.source["osmTags"])]
const sourcesList: TagsFilter[] = [TagUtils.Tag(layer.source["osmTags"])]
if (layer?.title) {
sourcesList.push(...new TagRenderingConfig(layer.title).usedTags())
}
@ -120,7 +109,7 @@ class GenerateStats extends Script {
const allBrands = Object.keys(data)
allBrands.sort()
for (const country of allCountries) {
for (const country of Array.from(allCountries)) {
const summary = <Record<string, number>>{}
for (const brand of allBrands) {
const count = data[brand][country]
@ -150,7 +139,7 @@ class GenerateStats extends Script {
path
)
}
const nsi = await NameSuggestionIndex.getNsiIndex()
const nsi = await NameSuggestionIndex.getNsiIndex("./assets/data/nsi/")
const allBrandNames: string[] = Utils.Dedup(
nsi.allPossible(<any>type).map((item) => item.tags[type])
)