Update tag totals, sort title tags by popularity to give the most precise title

This commit is contained in:
Pieter Vander Vennet 2023-12-04 16:10:05 +01:00
parent baf858bc21
commit 3135b83598
7 changed files with 485 additions and 213 deletions

View file

@ -16,10 +16,10 @@ import {
} from "./Json/QuestionableTagRenderingConfigJson"
import { FixedUiElement } from "../../UI/Base/FixedUiElement"
import { Paragraph } from "../../UI/Base/Paragraph"
import Svg from "../../Svg"
import Validators, { ValidatorType } from "../../UI/InputElement/Validators"
import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson"
import Constants from "../Constants"
import { RegexTag } from "../../Logic/Tags/RegexTag"
export interface Icon {}
@ -800,4 +800,25 @@ export default class TagRenderingConfig {
labels,
]).SetClass("flex flex-col")
}
public usedTags(): TagsFilter[] {
const tags: TagsFilter[] = []
tags.push(
this.metacondition,
this.condition,
this.freeform?.key ? new RegexTag(this.freeform?.key, /.*/) : undefined,
this.invalidValues
)
for (const m of this.mappings ?? []) {
tags.push(m.if)
tags.push(m.priorityIf)
tags.push(...(m.addExtraTags ?? []))
if (typeof m.hideInAnswer !== "boolean") {
tags.push(m.hideInAnswer)
}
tags.push(m.ifnot)
}
return Utils.NoNull(tags)
}
}