feat: Added a test tab in awards to test the matching

This commit is contained in:
2026-07-14 16:32:49 +02:00
parent 4fe0405432
commit 0c6f8e2d68
8 changed files with 574 additions and 13 deletions
+141
View File
@@ -338,6 +338,114 @@ export namespace award {
return a;
}
}
export class Rejected {
candidate: string;
reason: string;
static createFrom(source: any = {}) {
return new Rejected(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.candidate = source["candidate"];
this.reason = source["reason"];
}
}
export class Step {
rule: string;
field: string;
match_by?: string;
exact?: boolean;
pattern?: string;
field_value?: string;
candidates?: string[];
kept?: string[];
rejected?: Rejected[];
skipped?: boolean;
error?: string;
static createFrom(source: any = {}) {
return new Step(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.rule = source["rule"];
this.field = source["field"];
this.match_by = source["match_by"];
this.exact = source["exact"];
this.pattern = source["pattern"];
this.field_value = source["field_value"];
this.candidates = source["candidates"];
this.kept = source["kept"];
this.rejected = this.convertValues(source["rejected"], Rejected);
this.skipped = source["skipped"];
this.error = source["error"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Explanation {
code: string;
in_scope: boolean;
scope_error?: string;
predefined: boolean;
ref_count: number;
steps: Step[];
manual?: string[];
result: string[];
static createFrom(source: any = {}) {
return new Explanation(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.code = source["code"];
this.in_scope = source["in_scope"];
this.scope_error = source["scope_error"];
this.predefined = source["predefined"];
this.ref_count = source["ref_count"];
this.steps = this.convertValues(source["steps"], Step);
this.manual = source["manual"];
this.result = source["result"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Ref {
ref: string;
@@ -369,6 +477,7 @@ export namespace award {
this.validated_bands = source["validated_bands"];
}
}
export class Result {
code: string;
name: string;
@@ -1271,6 +1380,38 @@ export namespace main {
this.enabled = source["enabled"];
}
}
export class AwardExplain {
qso: qso.QSO;
explanation: award.Explanation;
static createFrom(source: any = {}) {
return new AwardExplain(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.qso = this.convertValues(source["qso"], qso.QSO);
this.explanation = this.convertValues(source["explanation"], award.Explanation);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class AwardImportPreviewEntry {
code: string;
name: string;