feat: Saison-Upgrade-Prüfung und Kür-Vorbehalt bei Artistic
Die Kür kann jetzt gegen eine andere Saison verglichen werden, ohne sie umzustellen. `SeasonUpgradeCheck` vergleicht das Regelpaket der Kür mit dem einer Ziel-Saison und berichtet die Unterschiede für genau diese Kür: - Elemente, die es in der Ziel-Saison nicht gibt, und geänderte Base Values (einzeln und als Summe) - Features, die dort unbekannt sind, und Level, die sich daraus anders ergeben - geänderte Kategorie-Grenzen (Dauer, Anzahlen, Level-Caps, Pflichtelemente) - die Befunde der Prüfung gegen die Ziel-Saison Der Dialog hängt am Prüfdialog („ⓘ Gegen andere Saison prüfen …") und ist bewusst nicht exklusiv, damit er sich über den Prüfdialog legen kann. „Prüfen" ändert nichts; „Auf Saison umstellen" übernimmt nur die Saison und lässt die Elemente unangetastet. Zusätzlich: Der Prüfdialog und `docs/manual.md` stellen klar, dass die Adult-Kategorie-Grenzen für die Kür gelten – Artistic hat eigene Anforderungen und wird noch nicht geprüft (Entscheidung steht in der Roadmap).
This commit is contained in:
parent
dfe775ac34
commit
1b5649e7dd
10 changed files with 821 additions and 12 deletions
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
Stand: 2026-11-13
|
||||
|
||||
Status: **weitgehend umgesetzt.** Die Schritte 1–5 der Umsetzungsreihenfolge
|
||||
stehen: Saisonordner, Manifest, Policies, Invariantenkatalog A–F, Saison an der
|
||||
Kür, Validator pro Regelpaket, Oberfläche und Export folgen der Saison. Offen
|
||||
sind die Saison-Upgrade-Prüfung (Schritt 6) und die Feature-Grenzen pro Fuß
|
||||
(Schritt 7).
|
||||
Status: **umgesetzt** bis auf Schritt 7. Saisonordner, Manifest, Policies,
|
||||
Invariantenkatalog A–F, Saison an der Kür, Validator pro Regelpaket,
|
||||
Oberfläche, Export und die Saison-Upgrade-Prüfung stehen. Offen sind die
|
||||
Feature-Grenzen pro Fuß (Schritt 7) und eine PDF-Ausgabe des Vergleichs.
|
||||
|
||||
## Zweck
|
||||
|
||||
|
|
@ -360,7 +359,7 @@ den zwei erwarteten Befunden.
|
|||
| F4 | Jede Saison deklariert dieselbe Policy-Menge – oder die Abweichung steht in `notes.md` | Warnung |
|
||||
| F5 | Für jede Policy existiert ein Test, dass sie in einer Saison ohne den Schlüssel nicht wirkt | Warnung |
|
||||
|
||||
## Saison-Upgrade-Prüfung (geplantes Feature)
|
||||
## Saison-Upgrade-Prüfung
|
||||
|
||||
**Motivation:** Ein Verein stellt im Sommer auf die neue Saison um und muss
|
||||
wissen, was an bestehenden Küren bricht. Heute gibt es dafür keine Antwort
|
||||
|
|
@ -369,10 +368,10 @@ außer „Kür öffnen und hoffen".
|
|||
**Nutzen:** Das ist der eigentliche Grund, warum sich die Mehrsaison-Struktur
|
||||
für den Anwender auszahlt – nicht das Archiv, sondern der Vergleich.
|
||||
|
||||
**Voraussetzung:** Der Validator ist eine reine Funktion über
|
||||
(Kür, Regelpaket). Der Bericht ist dann die Differenz zweier Prüfläufe plus
|
||||
ein Katalog-Diff. Deshalb ist das Feature „fast gratis", sobald die
|
||||
Saison-Kontext-Umstellung steht – aber nicht vorher.
|
||||
**Stand:** umgesetzt (`SeasonUpgradeCheck`). Der Validator ist eine reine
|
||||
Funktion über (Kür, Regelpaket); der Bericht ist die Differenz zweier Pakete
|
||||
für diese eine Kür. Bis auf den PDF-Export (siehe offene Punkte) entspricht
|
||||
die Umsetzung dieser Planung.
|
||||
|
||||
### Bedienung
|
||||
|
||||
|
|
@ -512,7 +511,7 @@ heute absolute Werte der aktiven Saison. Umbau:
|
|||
| 3 ✅ | Validator als Funktion über (Kür, Regelpaket) | Kein globaler Katalog mehr in den Prüfpfaden; Saison-Paar-Test grün |
|
||||
| 4 ✅ | Inspector, Picker, Kategorie folgen dem Kontext | Eine 2025/26-Kür bietet nur 2025/26-Elemente an |
|
||||
| 5 ✅ | Saison-Anzeige in Statusleiste, Prüfdialog und PDF | Auf dem PDF ist die Saison lesbar |
|
||||
| 6 | Saison-Upgrade-Prüfung | Beispielausgabe oben ist reproduzierbar |
|
||||
| 6 ✅ | Saison-Upgrade-Prüfung | Beispielausgabe oben ist reproduzierbar |
|
||||
| 7 | „Max. zwei Features pro Fuß" als Policy | Neue Regel ohne GDScript-Änderung ergänzbar |
|
||||
|
||||
Schritte 1 und 3 sind der Hebel; alles andere baut darauf auf.
|
||||
|
|
|
|||
|
|
@ -302,6 +302,22 @@ Beim Wechsel der Saison bleiben die Elemente unverändert. Eine Adult-Kategorie,
|
|||
die es in der neuen Saison nicht gibt, wird nicht gelöscht, sondern als
|
||||
„nicht verfügbar" angezeigt.
|
||||
|
||||
### Saison-Vergleich
|
||||
|
||||
Im Prüfdialog führt der Link **ⓘ Gegen andere Saison prüfen …** zum Vergleich
|
||||
mit einer anderen Saison. Der Bericht sagt, was sich für diese Kür ändert:
|
||||
|
||||
- Elemente, die es dort nicht mehr gibt
|
||||
- Base Values, die sich ändern (einzeln und als Summe)
|
||||
- Features, die in der Ziel-Saison unbekannt sind
|
||||
- Level, die sich aus den Features anders ergeben
|
||||
- geänderte Kategorie-Grenzen (Dauer, Anzahlen, Level-Caps, Pflichtelemente)
|
||||
- die Befunde der Prüfung gegen die Ziel-Saison
|
||||
|
||||
Der Vergleich **ändert nichts**. Erst „Auf Saison umstellen" übernimmt die
|
||||
Saison; die Elemente bleiben unangetastet, auch wenn einzelne davon in der
|
||||
neuen Saison nicht mehr existieren.
|
||||
|
||||
## Sprungkombinationen
|
||||
|
||||
Sprungkombinationen und -folgen sind strukturiert:
|
||||
|
|
@ -347,6 +363,13 @@ Für Pirouetten und Schrittsequenzen gilt:
|
|||
|
||||
Die Kategorie wird in der Statusleiste gewählt und mit der Kür gespeichert.
|
||||
|
||||
**Die Grenzen gelten für die Kür (Free Skating).** Bei der ISU Adult
|
||||
Competition gibt es daneben ein eigenes Artistic-Programm mit anderen
|
||||
Anforderungen (1:30 bzw. 2:00, 1–2 Sprünge, 1–2 Pirouetten, kein Axel in
|
||||
Bronze/Silver/Gold, keine Sturzabzüge). Der Rinkplanner prüft es noch nicht;
|
||||
für ein Artistic-Programm sind die Kategorie-Befunde deshalb nicht
|
||||
aussagekräftig. Siehe Roadmap, „Artistic Free Skating – Entscheidung offen".
|
||||
|
||||
| | Gold | Silver | Bronze |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| Dauer | 2:50 ±10 s | 2:00 ±10 s | 1:40 ±10 s |
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ OAuth-App ist nicht veröffentlicht. Google Drive und OneDrive stehen unter
|
|||
- [x] Mehrsaison-Struktur: Regelpaket pro Saison (Ordner, Manifest,
|
||||
deklarative Policies), alte Küren gegen ihre eigene Saison prüfen;
|
||||
Zielbild und Invariantenkatalog in `docs/isu-rules-structure.md`
|
||||
- [ ] Saison-Upgrade-Prüfung: bestehende Kür gegen eine andere Saison prüfen
|
||||
- [x] Saison-Upgrade-Prüfung: bestehende Kür gegen eine andere Saison prüfen
|
||||
und nur berichten („2 Elemente nicht mehr im Katalog", „1 Feature
|
||||
entfallen", „Dauer jetzt 10 s zu lang"), ohne die Kür zu ändern
|
||||
- [ ] Max. zwei Features pro Fuß und Feature-Positionsregeln
|
||||
|
|
|
|||
|
|
@ -761,3 +761,31 @@
|
|||
"Saison nicht festgelegt: In der Statusleiste wählen, sonst prüft die App nichts.","Saison nicht festgelegt: In der Statusleiste wählen, sonst prüft die App nichts.","Season not assigned: pick one in the status bar, otherwise nothing is checked."
|
||||
"Saison „%s“ kennt diese App-Version nicht. Bitte die App aktualisieren.","Saison „%s“ kennt diese App-Version nicht. Bitte die App aktualisieren.","This app version does not know season “%s”. Please update the app."
|
||||
"nicht festgelegt","nicht festgelegt","not assigned"
|
||||
"nicht im Katalog","nicht im Katalog","not in the catalog"
|
||||
"Sprungelemente max.","Sprungelemente max.","Jump elements max."
|
||||
"Pirouetten max.","Pirouetten max.","Spins max."
|
||||
"Schrittsequenzen max.","Schrittsequenzen max.","Step sequences max."
|
||||
"Choreo-Sequenzen max.","Choreo-Sequenzen max.","Choreo sequences max."
|
||||
"Level-Grenzen (Pirouette/Sequenz)","Level-Grenzen (Pirouette/Sequenz)","Level caps (spin/sequence)"
|
||||
"Verbotene Sprünge","Verbotene Sprünge","Forbidden jumps"
|
||||
"Pflichtelemente","Pflichtelemente","Required elements"
|
||||
"PCS-Faktor","PCS-Faktor","PCS factor"
|
||||
"Sturzabzug","Sturzabzug","Fall deduction"
|
||||
"Ziel-Saison","Ziel-Saison","Target season"
|
||||
"Ziel-Saison nicht verfügbar.","Ziel-Saison nicht verfügbar.","Target season not available."
|
||||
"Keine Unterschiede: Die Kür passt in beide Saisons.","Keine Unterschiede: Die Kür passt in beide Saisons.","No differences: the programme fits both seasons."
|
||||
"Elemente","Elemente","Elements"
|
||||
"Base Values","Base Values","Base values"
|
||||
"in der Ziel-Saison unbekannt","in der Ziel-Saison unbekannt","unknown in the target season"
|
||||
"in der Ziel-Saison nicht vorhanden","in der Ziel-Saison nicht vorhanden","not available in the target season"
|
||||
"Basiswert %s → %s (%s%s)","Basiswert %s → %s (%s%s)","Base value %s → %s (%s%s)"
|
||||
"Keine Elemente mit Base Value.","Keine Elemente mit Base Value.","No elements with a base value."
|
||||
"Befunde bei Prüfung gegen %s","Befunde bei Prüfung gegen %s","Findings when checked against %s"
|
||||
"ⓘ Gegen andere Saison prüfen …","ⓘ Gegen andere Saison prüfen …","ⓘ Check against another season …"
|
||||
"Die Kategorie-Grenzen gelten für die Kür; Artistic wird nicht geprüft.","Die Kategorie-Grenzen gelten für die Kür; Artistic wird nicht geprüft.","The category limits apply to free skating; artistic is not checked."
|
||||
"Saison-Vergleich","Saison-Vergleich","Season comparison"
|
||||
"Auf Saison umstellen","Auf Saison umstellen","Switch season"
|
||||
"Prüfen ändert nichts. Umstellen übernimmt nur die Saison, keine Elemente.","Prüfen ändert nichts. Umstellen übernimmt nur die Saison, keine Elemente.","Checking changes nothing. Switching applies only the season, not the elements."
|
||||
"Summe","Summe","Total"
|
||||
"Level","Level","Level"
|
||||
"Features","Features","Features"
|
||||
|
|
|
|||
|
|
|
@ -1831,6 +1831,74 @@ theme_override_font_sizes/font_size = 13
|
|||
text = "Grobe Schätzung: PCS = Durchschnitt × 3 Komponenten × Kategorie-Faktor. Abzug = Stürze × Kategorie-Abzug. GOE ist nicht enthalten."
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="UpgradeDialog" type="AcceptDialog" parent="."]
|
||||
unique_name_in_owner = true
|
||||
title = "Saison-Vergleich"
|
||||
size = Vector2i(760, 620)
|
||||
exclusive = false
|
||||
ok_button_text = "Schließen"
|
||||
|
||||
[node name="UpgradeBox" type="VBoxContainer" parent="UpgradeDialog"]
|
||||
offset_left = 12.0
|
||||
offset_top = 12.0
|
||||
offset_right = 748.0
|
||||
offset_bottom = 556.0
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="UpgradeRow" type="HBoxContainer" parent="UpgradeDialog/UpgradeBox"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="UpgradeSeasonLabel" type="Label" parent="UpgradeDialog/UpgradeBox/UpgradeRow"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = "Ziel-Saison"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UpgradeSeasonOption" type="OptionButton" parent="UpgradeDialog/UpgradeBox/UpgradeRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(190, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 15
|
||||
|
||||
[node name="UpgradeRunButton" type="Button" parent="UpgradeDialog/UpgradeBox/UpgradeRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(110, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Prüfen"
|
||||
|
||||
[node name="UpgradeText" type="RichTextLabel" parent="UpgradeDialog/UpgradeBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
bbcode_enabled = true
|
||||
scroll_active = true
|
||||
selection_enabled = true
|
||||
|
||||
[node name="UpgradeActions" type="HBoxContainer" parent="UpgradeDialog/UpgradeBox"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="UpgradeApplyButton" type="Button" parent="UpgradeDialog/UpgradeBox/UpgradeActions"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(210, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Auf Saison umstellen"
|
||||
|
||||
[node name="UpgradeHint" type="Label" parent="UpgradeDialog/UpgradeBox/UpgradeActions"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "Prüfen ändert nichts. Umstellen übernimmt nur die Saison, keine Elemente."
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="HelpDialog" type="AcceptDialog" parent="."]
|
||||
unique_name_in_owner = true
|
||||
title = "Hilfe & Annahmen"
|
||||
|
|
|
|||
347
rinkplanner/src/core/rules/season_upgrade_check.gd
Normal file
347
rinkplanner/src/core/rules/season_upgrade_check.gd
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
class_name SeasonUpgradeCheck
|
||||
extends RefCounted
|
||||
|
||||
## Compares one routine against the rule package of another season.
|
||||
##
|
||||
## The check never changes the routine: it reports what differs between the two
|
||||
## seasons for this specific routine (catalog, base values, levels, features,
|
||||
## category limits) plus the findings the target season's validator produces.
|
||||
## See `docs/isu-rules-structure.md`, section "Saison-Upgrade-Prüfung".
|
||||
|
||||
const KIND_MISSING_CODE := "missing_code"
|
||||
const KIND_TYPE_CHANGE := "type_change"
|
||||
const KIND_VALUE_CHANGE := "value_change"
|
||||
const KIND_LEVEL_CHANGE := "level_change"
|
||||
const KIND_UNKNOWN_FEATURE := "unknown_feature"
|
||||
const KIND_CATEGORY_CHANGE := "category_change"
|
||||
const KIND_CATEGORY_MISSING := "category_missing"
|
||||
|
||||
|
||||
class Change extends RefCounted:
|
||||
var kind: String = ""
|
||||
var label: String = ""
|
||||
var before: String = ""
|
||||
var after: String = ""
|
||||
var section_id: String = ""
|
||||
var segment_id: String = ""
|
||||
|
||||
|
||||
class Report extends RefCounted:
|
||||
var source_season: String = ""
|
||||
var target_season: String = ""
|
||||
var changes: Array[Change] = []
|
||||
var issues: Array[ValidationIssue] = []
|
||||
var base_value_before: float = 0.0
|
||||
var base_value_after: float = 0.0
|
||||
|
||||
func changes_of(kind: String) -> Array:
|
||||
var result: Array = []
|
||||
for change: Change in changes:
|
||||
if change.kind == kind:
|
||||
result.append(change)
|
||||
return result
|
||||
|
||||
## True when the two seasons disagree about anything in this routine.
|
||||
func has_changes() -> bool:
|
||||
return not changes.is_empty() or not is_equal_approx(
|
||||
base_value_before,
|
||||
base_value_after
|
||||
)
|
||||
|
||||
func has_element_changes() -> bool:
|
||||
return (
|
||||
not changes_of(KIND_MISSING_CODE).is_empty()
|
||||
or not changes_of(KIND_TYPE_CHANGE).is_empty()
|
||||
or not changes_of(KIND_VALUE_CHANGE).is_empty()
|
||||
)
|
||||
|
||||
func value_delta() -> float:
|
||||
return base_value_after - base_value_before
|
||||
|
||||
|
||||
static func run(
|
||||
routine: Routine,
|
||||
source: RulesPackage,
|
||||
target: RulesPackage
|
||||
) -> Report:
|
||||
var report := Report.new()
|
||||
if source != null:
|
||||
report.source_season = source.season
|
||||
if target != null:
|
||||
report.target_season = target.season
|
||||
if routine == null or target == null:
|
||||
return report
|
||||
if target.catalog == null or target.levels == null:
|
||||
return report
|
||||
|
||||
for section: RoutineSection in routine.sections:
|
||||
if section == null:
|
||||
continue
|
||||
for element: ResolvedElement in section.get_elements():
|
||||
var segment := element.get_lead()
|
||||
if segment == null:
|
||||
continue
|
||||
_check_element(segment, section.section_id, source, target, report)
|
||||
|
||||
_compare_category(routine, source, target, report)
|
||||
|
||||
var validator := RoutineValidator.new(
|
||||
target.catalog,
|
||||
target.levels,
|
||||
target.adult
|
||||
)
|
||||
report.issues = validator.validate(routine)
|
||||
return report
|
||||
|
||||
|
||||
static func _check_element(
|
||||
segment: PathSegment,
|
||||
section_id: String,
|
||||
source: RulesPackage,
|
||||
target: RulesPackage,
|
||||
report: Report
|
||||
) -> void:
|
||||
var code := segment.element_code.strip_edges()
|
||||
if code.is_empty():
|
||||
return
|
||||
|
||||
var label := segment.get_element_caption()
|
||||
if label.is_empty():
|
||||
label = PathSegment.element_type_name(segment.element_type)
|
||||
|
||||
var before := -1.0
|
||||
if source != null and source.catalog != null:
|
||||
before = source.catalog.get_segment_base_value(segment)
|
||||
var after := target.catalog.get_segment_base_value(segment)
|
||||
if before >= 0.0:
|
||||
report.base_value_before += before
|
||||
if after >= 0.0:
|
||||
report.base_value_after += after
|
||||
|
||||
var definition := target.catalog.find(code)
|
||||
if definition == null:
|
||||
_add(
|
||||
report,
|
||||
KIND_MISSING_CODE,
|
||||
label,
|
||||
I18n.t("nicht im Katalog"),
|
||||
"",
|
||||
section_id,
|
||||
segment.segment_id
|
||||
)
|
||||
return
|
||||
|
||||
if definition.element_type != segment.element_type:
|
||||
_add(
|
||||
report,
|
||||
KIND_TYPE_CHANGE,
|
||||
label,
|
||||
PathSegment.element_type_name(segment.element_type),
|
||||
PathSegment.element_type_name(definition.element_type),
|
||||
section_id,
|
||||
segment.segment_id
|
||||
)
|
||||
|
||||
if before >= 0.0 and after >= 0.0 and not is_equal_approx(before, after):
|
||||
_add(
|
||||
report,
|
||||
KIND_VALUE_CHANGE,
|
||||
label,
|
||||
_number(before),
|
||||
_number(after),
|
||||
section_id,
|
||||
segment.segment_id
|
||||
)
|
||||
|
||||
for raw: String in segment.element_features:
|
||||
if target.levels.get_feature(segment.element_type, raw) == null:
|
||||
_add(
|
||||
report,
|
||||
KIND_UNKNOWN_FEATURE,
|
||||
label,
|
||||
raw,
|
||||
"",
|
||||
section_id,
|
||||
segment.segment_id
|
||||
)
|
||||
|
||||
var result := target.levels.calculate_level(
|
||||
segment.element_type,
|
||||
code,
|
||||
segment.element_features
|
||||
)
|
||||
if result.level != segment.element_level:
|
||||
_add(
|
||||
report,
|
||||
KIND_LEVEL_CHANGE,
|
||||
label,
|
||||
_level_label(segment.element_level),
|
||||
_level_label(result.level),
|
||||
section_id,
|
||||
segment.segment_id
|
||||
)
|
||||
|
||||
|
||||
static func _compare_category(
|
||||
routine: Routine,
|
||||
source: RulesPackage,
|
||||
target: RulesPackage,
|
||||
report: Report
|
||||
) -> void:
|
||||
var code := routine.adult_category.strip_edges()
|
||||
if code.is_empty():
|
||||
return
|
||||
var new_category: AdultCategoryRules.Category = null
|
||||
if target.adult != null:
|
||||
new_category = target.adult.get_category(code)
|
||||
if new_category == null:
|
||||
_add(
|
||||
report,
|
||||
KIND_CATEGORY_MISSING,
|
||||
_category_name(code, source),
|
||||
"",
|
||||
""
|
||||
)
|
||||
return
|
||||
if source == null or source.adult == null:
|
||||
return
|
||||
var old_category := source.adult.get_category(code)
|
||||
if old_category == null:
|
||||
return
|
||||
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Dauer"),
|
||||
_duration(old_category),
|
||||
_duration(new_category)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Sprungelemente max."),
|
||||
str(old_category.max_jump_elements),
|
||||
str(new_category.max_jump_elements)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Pirouetten max."),
|
||||
str(old_category.max_spins),
|
||||
str(new_category.max_spins)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Schrittsequenzen max."),
|
||||
str(old_category.max_step_sequences),
|
||||
str(new_category.max_step_sequences)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Choreo-Sequenzen max."),
|
||||
str(old_category.max_choreographic_sequences),
|
||||
str(new_category.max_choreographic_sequences)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Level-Grenzen (Pirouette/Sequenz)"),
|
||||
"%d / %d" % [old_category.max_spin_level, old_category.max_sequence_level],
|
||||
"%d / %d" % [new_category.max_spin_level, new_category.max_sequence_level]
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Verbotene Sprünge"),
|
||||
_join_or_none(old_category.forbidden_jumps),
|
||||
_join_or_none(new_category.forbidden_jumps)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Pflichtelemente"),
|
||||
_required_elements(old_category),
|
||||
_required_elements(new_category)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("PCS-Faktor"),
|
||||
_number(old_category.pcs_factor),
|
||||
_number(new_category.pcs_factor)
|
||||
)
|
||||
_compare_field(
|
||||
report,
|
||||
I18n.t("Sturzabzug"),
|
||||
_number(old_category.fall_deduction),
|
||||
_number(new_category.fall_deduction)
|
||||
)
|
||||
|
||||
|
||||
static func _compare_field(
|
||||
report: Report,
|
||||
label: String,
|
||||
before: String,
|
||||
after: String
|
||||
) -> void:
|
||||
if before == after:
|
||||
return
|
||||
_add(report, KIND_CATEGORY_CHANGE, label, before, after)
|
||||
|
||||
|
||||
static func _add(
|
||||
report: Report,
|
||||
kind: String,
|
||||
label: String,
|
||||
before: String,
|
||||
after: String = "",
|
||||
section_id: String = "",
|
||||
segment_id: String = ""
|
||||
) -> void:
|
||||
var change := Change.new()
|
||||
change.kind = kind
|
||||
change.label = label
|
||||
change.before = before
|
||||
change.after = after
|
||||
change.section_id = section_id
|
||||
change.segment_id = segment_id
|
||||
report.changes.append(change)
|
||||
|
||||
|
||||
static func _category_name(code: String, source: RulesPackage) -> String:
|
||||
if source != null and source.adult != null:
|
||||
var category := source.adult.get_category(code)
|
||||
if category != null:
|
||||
return category.name
|
||||
return code.capitalize()
|
||||
|
||||
|
||||
static func _duration(category: AdultCategoryRules.Category) -> String:
|
||||
return "%s ±%d s" % [
|
||||
_clock(category.duration_seconds),
|
||||
category.duration_tolerance_seconds,
|
||||
]
|
||||
|
||||
|
||||
static func _clock(seconds: int) -> String:
|
||||
return "%d:%02d" % [seconds / 60, seconds % 60]
|
||||
|
||||
|
||||
static func _required_elements(category: AdultCategoryRules.Category) -> String:
|
||||
var parts := PackedStringArray()
|
||||
if category.required_axel:
|
||||
parts.append("Axel")
|
||||
if category.requires_choreographic_spin:
|
||||
parts.append("ChSp")
|
||||
if category.required_step_sequences > 0:
|
||||
parts.append("%d × StSq" % category.required_step_sequences)
|
||||
if category.required_choreographic_sequences > 0:
|
||||
parts.append("%d × ChSq" % category.required_choreographic_sequences)
|
||||
return "—" if parts.is_empty() else ", ".join(parts)
|
||||
|
||||
|
||||
static func _join_or_none(codes: PackedStringArray) -> String:
|
||||
if codes.is_empty():
|
||||
return "—"
|
||||
return ", ".join(codes)
|
||||
|
||||
|
||||
static func _level_label(level: int) -> String:
|
||||
return "Base" if level <= 0 else I18n.t("Level %d") % level
|
||||
|
||||
|
||||
static func _number(value: float) -> String:
|
||||
return String.num(value, 2).replace(".", ",")
|
||||
1
rinkplanner/src/core/rules/season_upgrade_check.gd.uid
Normal file
1
rinkplanner/src/core/rules/season_upgrade_check.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bvxgilq1ikpt3
|
||||
|
|
@ -226,6 +226,11 @@ const UPDATE_FILE_NAMES := {
|
|||
@onready var season_option: OptionButton = %SeasonOption
|
||||
@onready var adult_category_option: OptionButton = %AdultCategoryOption
|
||||
@onready var validation_dialog: AcceptDialog = %ValidationDialog
|
||||
@onready var upgrade_dialog: AcceptDialog = %UpgradeDialog
|
||||
@onready var upgrade_text: RichTextLabel = %UpgradeText
|
||||
@onready var upgrade_season_option: OptionButton = %UpgradeSeasonOption
|
||||
@onready var upgrade_run_button: Button = %UpgradeRunButton
|
||||
@onready var upgrade_apply_button: Button = %UpgradeApplyButton
|
||||
@onready var validation_text: RichTextLabel = %ValidationText
|
||||
@onready var score_assumptions_panel: VBoxContainer = %ScoreAssumptionsPanel
|
||||
@onready var pcs_average_spin: SpinBox = %PcsAverageSpin
|
||||
|
|
@ -339,6 +344,8 @@ var _dialog_jump_kind: PathSegment.JumpKind = PathSegment.JumpKind.SOLO
|
|||
var _dialog_combination_jumps: PackedStringArray = PackedStringArray()
|
||||
var _show_score_info: bool = false
|
||||
var _show_score_assumptions: bool = false
|
||||
var _upgrade_target_season: String = ""
|
||||
var _upgrade_report: SeasonUpgradeCheck.Report
|
||||
var _preset_speed: float = DEFAULT_SPEED_MPS
|
||||
var _current_path: String = ""
|
||||
var _last_export_path: String = ""
|
||||
|
|
@ -446,6 +453,7 @@ func _ready() -> void:
|
|||
_setup_timing_controls()
|
||||
_setup_element_controls()
|
||||
_setup_season_controls()
|
||||
_setup_upgrade_controls()
|
||||
_setup_adult_category_controls()
|
||||
_setup_export_controls()
|
||||
labels_toggle.set_pressed_no_signal(rink_canvas.labels_visible)
|
||||
|
|
@ -900,6 +908,11 @@ func _render_validation_dialog() -> void:
|
|||
var season_note := _season_note()
|
||||
if not season_note.is_empty():
|
||||
lines.append("[color=#e0b050]%s[/color]" % season_note)
|
||||
if _can_compare_seasons():
|
||||
lines.append(
|
||||
"[url=upgrade][color=#60a5fa]%s[/color][/url]"
|
||||
% I18n.t("ⓘ Gegen andere Saison prüfen …")
|
||||
)
|
||||
var category: AdultCategoryRules.Category = null
|
||||
if (
|
||||
_routine != null
|
||||
|
|
@ -915,6 +928,13 @@ func _render_validation_dialog() -> void:
|
|||
category.duration_tolerance_seconds,
|
||||
]
|
||||
lines.append("[b]Kategorie: %s[/b]" % category_name)
|
||||
if category != null:
|
||||
lines.append(
|
||||
"[color=#94a3b8]%s[/color]"
|
||||
% I18n.t(
|
||||
"Die Kategorie-Grenzen gelten für die Kür; Artistic wird nicht geprüft."
|
||||
)
|
||||
)
|
||||
lines.append("")
|
||||
lines.append(
|
||||
"[b]Basiswert: %s[/b]" % _format_base_value(report.base_value_total)
|
||||
|
|
@ -1033,6 +1053,218 @@ func _render_validation_dialog() -> void:
|
|||
validation_dialog.popup_centered(target)
|
||||
|
||||
|
||||
## Opens the season comparison for the current routine. It only reports; the
|
||||
## routine changes season when the user confirms it.
|
||||
func open_upgrade_dialog() -> void:
|
||||
if _routine == null or _rules_package == null or _rules_library == null:
|
||||
return
|
||||
if _rules_library.get_seasons().size() < 2:
|
||||
return
|
||||
_fill_upgrade_seasons()
|
||||
_run_upgrade_check()
|
||||
var target := Vector2i(760, 620)
|
||||
var viewport_size := Vector2i(get_viewport_rect().size)
|
||||
if viewport_size.x > 0:
|
||||
target.x = mini(target.x, viewport_size.x)
|
||||
if viewport_size.y > 0:
|
||||
target.y = mini(target.y, viewport_size.y)
|
||||
upgrade_dialog.popup_centered(target)
|
||||
|
||||
|
||||
func _fill_upgrade_seasons() -> void:
|
||||
upgrade_season_option.clear()
|
||||
var current := _routine.season.strip_edges()
|
||||
for season: String in _rules_library.get_seasons():
|
||||
if season == current:
|
||||
continue
|
||||
var index := upgrade_season_option.item_count
|
||||
upgrade_season_option.add_item(I18n.t("Saison %s") % season, index)
|
||||
upgrade_season_option.set_item_metadata(index, season)
|
||||
if upgrade_season_option.item_count > 0:
|
||||
upgrade_season_option.select(0)
|
||||
|
||||
|
||||
func _selected_upgrade_season() -> String:
|
||||
var index := upgrade_season_option.selected
|
||||
if index < 0:
|
||||
return ""
|
||||
return str(upgrade_season_option.get_item_metadata(index))
|
||||
|
||||
|
||||
func _run_upgrade_check() -> void:
|
||||
if _routine == null or _rules_package == null or _rules_library == null:
|
||||
return
|
||||
var season := _selected_upgrade_season()
|
||||
_upgrade_target_season = season
|
||||
var target := _rules_library.get_package(season)
|
||||
if target == null:
|
||||
upgrade_text.text = I18n.t("Ziel-Saison nicht verfügbar.")
|
||||
upgrade_apply_button.disabled = true
|
||||
return
|
||||
_upgrade_report = SeasonUpgradeCheck.run(_routine, _rules_package, target)
|
||||
upgrade_text.text = I18n.join_lines(_upgrade_report_lines(_upgrade_report))
|
||||
upgrade_apply_button.disabled = false
|
||||
|
||||
|
||||
func _upgrade_report_lines(report: SeasonUpgradeCheck.Report) -> PackedStringArray:
|
||||
var lines := PackedStringArray()
|
||||
var title := _routine.title.strip_edges()
|
||||
if title.is_empty():
|
||||
title = I18n.t("Unbenannte Kür")
|
||||
lines.append(
|
||||
"[b]%s — %s → %s[/b]"
|
||||
% [
|
||||
_escape_bbcode(title),
|
||||
report.source_season,
|
||||
report.target_season,
|
||||
]
|
||||
)
|
||||
|
||||
if not report.has_changes():
|
||||
lines.append("")
|
||||
lines.append(
|
||||
I18n.t("Keine Unterschiede: Die Kür passt in beide Saisons.")
|
||||
)
|
||||
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Elemente"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_MISSING_CODE),
|
||||
I18n.t("nicht im Katalog")
|
||||
)
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Base Values"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_VALUE_CHANGE)
|
||||
)
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Elementtyp"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_TYPE_CHANGE)
|
||||
)
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Features"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_UNKNOWN_FEATURE),
|
||||
I18n.t("in der Ziel-Saison unbekannt")
|
||||
)
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Level"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_LEVEL_CHANGE)
|
||||
)
|
||||
_append_upgrade_group(
|
||||
lines,
|
||||
I18n.t("Kategorie"),
|
||||
report.changes_of(SeasonUpgradeCheck.KIND_CATEGORY_CHANGE)
|
||||
)
|
||||
var missing_category := report.changes_of(
|
||||
SeasonUpgradeCheck.KIND_CATEGORY_MISSING
|
||||
)
|
||||
if not missing_category.is_empty():
|
||||
lines.append("")
|
||||
lines.append("[b]%s[/b]" % I18n.t("Kategorie"))
|
||||
lines.append(
|
||||
"● %s: %s"
|
||||
% [
|
||||
_escape_bbcode(missing_category[0].label),
|
||||
I18n.t("in der Ziel-Saison nicht vorhanden"),
|
||||
]
|
||||
)
|
||||
|
||||
lines.append("")
|
||||
lines.append("[b]%s[/b]" % I18n.t("Summe"))
|
||||
if report.base_value_before > 0.0 or report.base_value_after > 0.0:
|
||||
lines.append(
|
||||
I18n.t("Basiswert %s → %s (%s%s)")
|
||||
% [
|
||||
_format_base_value(report.base_value_before),
|
||||
_format_base_value(report.base_value_after),
|
||||
"+" if report.value_delta() >= 0.0 else "−",
|
||||
_format_base_value(absf(report.value_delta())),
|
||||
]
|
||||
)
|
||||
else:
|
||||
lines.append(I18n.t("Keine Elemente mit Base Value."))
|
||||
|
||||
if not report.issues.is_empty():
|
||||
lines.append("")
|
||||
lines.append(
|
||||
"[b]%s[/b]" % I18n.t("Befunde bei Prüfung gegen %s") % report.target_season
|
||||
)
|
||||
for issue: ValidationIssue in report.issues:
|
||||
var color := (
|
||||
"#ef4444"
|
||||
if issue.severity == ValidationIssue.Severity.ERROR
|
||||
else "#f59e0b"
|
||||
)
|
||||
lines.append(
|
||||
"[color=%s]●[/color] %s%s"
|
||||
% [
|
||||
color,
|
||||
_escape_bbcode(issue.message),
|
||||
_upgrade_location(issue.section_id),
|
||||
]
|
||||
)
|
||||
return lines
|
||||
|
||||
|
||||
func _append_upgrade_group(
|
||||
lines: PackedStringArray,
|
||||
title: String,
|
||||
changes: Array,
|
||||
suffix: String = ""
|
||||
) -> void:
|
||||
if changes.is_empty():
|
||||
return
|
||||
lines.append("")
|
||||
lines.append("[b]%s[/b]" % title)
|
||||
for change: SeasonUpgradeCheck.Change in changes:
|
||||
var text := _escape_bbcode(change.label)
|
||||
if change.kind == SeasonUpgradeCheck.KIND_MISSING_CODE:
|
||||
text += ": " + I18n.t("nicht im Katalog")
|
||||
elif change.kind == SeasonUpgradeCheck.KIND_UNKNOWN_FEATURE:
|
||||
text += ": %s — %s" % [
|
||||
I18n.t("Feature"),
|
||||
_escape_bbcode(change.before),
|
||||
]
|
||||
if not suffix.is_empty():
|
||||
text += " " + suffix
|
||||
elif change.kind == SeasonUpgradeCheck.KIND_CATEGORY_CHANGE:
|
||||
text = "%s: %s → %s" % [
|
||||
_escape_bbcode(change.label),
|
||||
_escape_bbcode(change.before),
|
||||
_escape_bbcode(change.after),
|
||||
]
|
||||
elif change.after.is_empty():
|
||||
text += ": " + _escape_bbcode(change.before)
|
||||
else:
|
||||
text += ": %s → %s" % [
|
||||
_escape_bbcode(change.before),
|
||||
_escape_bbcode(change.after),
|
||||
]
|
||||
text += _upgrade_location(change.section_id)
|
||||
lines.append("● %s" % text)
|
||||
|
||||
|
||||
func _upgrade_location(section_id: String) -> String:
|
||||
if section_id.is_empty() or _routine == null:
|
||||
return ""
|
||||
if _routine.sections.size() < 2:
|
||||
return ""
|
||||
var section := _routine.get_section_by_id(section_id)
|
||||
if section == null:
|
||||
return ""
|
||||
return " (%s)" % I18n.section_title(section.title)
|
||||
|
||||
|
||||
func _on_upgrade_apply_pressed() -> void:
|
||||
if _upgrade_target_season.is_empty():
|
||||
return
|
||||
if set_season(_upgrade_target_season):
|
||||
upgrade_dialog.hide()
|
||||
|
||||
|
||||
func _score_info_lines() -> PackedStringArray:
|
||||
var lines := PackedStringArray()
|
||||
lines.append("[b]Enthalten[/b]")
|
||||
|
|
@ -1326,6 +1558,16 @@ func _on_validation_meta_clicked(meta: Variant) -> void:
|
|||
_show_score_assumptions = not _show_score_assumptions
|
||||
_update_score_assumptions_panel()
|
||||
_render_validation_dialog()
|
||||
elif key == "upgrade":
|
||||
open_upgrade_dialog()
|
||||
|
||||
|
||||
func _can_compare_seasons() -> bool:
|
||||
return (
|
||||
_rules_package != null
|
||||
and _rules_library != null
|
||||
and _rules_library.get_seasons().size() > 1
|
||||
)
|
||||
|
||||
|
||||
func _update_score_assumptions_panel() -> void:
|
||||
|
|
@ -2691,6 +2933,19 @@ func _sync_adult_category_option() -> void:
|
|||
|
||||
## Fills the season dropdown. The list comes from the rules library, so a new
|
||||
## season folder appears without touching this code.
|
||||
func _setup_upgrade_controls() -> void:
|
||||
if upgrade_run_button != null:
|
||||
upgrade_run_button.pressed.connect(_run_upgrade_check)
|
||||
if upgrade_apply_button != null:
|
||||
upgrade_apply_button.pressed.connect(_on_upgrade_apply_pressed)
|
||||
if upgrade_season_option != null:
|
||||
upgrade_season_option.item_selected.connect(_on_upgrade_season_selected)
|
||||
|
||||
|
||||
func _on_upgrade_season_selected(_index: int) -> void:
|
||||
_run_upgrade_check()
|
||||
|
||||
|
||||
func _setup_season_controls() -> void:
|
||||
if season_option == null:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ func _init() -> void:
|
|||
_test_real_data_passes_audit()
|
||||
_test_broken_fixture_is_reported()
|
||||
_test_season_pair_difference()
|
||||
_test_upgrade_check()
|
||||
_cleanup()
|
||||
_finish()
|
||||
|
||||
|
|
@ -211,6 +212,58 @@ func _test_season_pair_difference() -> void:
|
|||
)
|
||||
|
||||
|
||||
## Die Saison-Upgrade-Prüfung berichtet Unterschiede, ohne die Kür zu ändern.
|
||||
func _test_upgrade_check() -> void:
|
||||
var library := RulesLibrary.scan()
|
||||
var current := library.get_package("2026/27")
|
||||
var older := library.get_package("2025/26")
|
||||
if current == null or older == null:
|
||||
_check(false, "both seasons load for the upgrade check")
|
||||
return
|
||||
|
||||
var routine := _make_pair_routine()
|
||||
var report := SeasonUpgradeCheck.run(routine, current, older)
|
||||
_check(report.source_season == "2026/27", "report names the source season")
|
||||
_check(report.target_season == "2025/26", "report names the target season")
|
||||
_check(report.has_changes(), "ChSp is reported as a change")
|
||||
var missing := report.changes_of(SeasonUpgradeCheck.KIND_MISSING_CODE)
|
||||
_check(missing.size() == 1, "one element is missing in the target season")
|
||||
if missing.size() == 1:
|
||||
_check(
|
||||
str(missing[0].label).contains("ChSp"),
|
||||
"the missing element is ChSp"
|
||||
)
|
||||
_check(
|
||||
report.base_value_before > 0.0 and report.base_value_after == 0.0,
|
||||
"the base value drops when the element disappears"
|
||||
)
|
||||
|
||||
var unchanged := SeasonUpgradeCheck.run(routine, current, current)
|
||||
_check(
|
||||
not unchanged.has_changes(),
|
||||
"comparing a season with itself reports no changes"
|
||||
)
|
||||
|
||||
# Category limits changed between the seasons (ChSp requirement, level caps).
|
||||
routine.adult_category = "gold"
|
||||
var category_report := SeasonUpgradeCheck.run(routine, current, older)
|
||||
var category_changes := category_report.changes_of(
|
||||
SeasonUpgradeCheck.KIND_CATEGORY_CHANGE
|
||||
)
|
||||
_check(
|
||||
category_changes.size() >= 2,
|
||||
"the category limits are part of the comparison"
|
||||
)
|
||||
var labels := PackedStringArray()
|
||||
for change: SeasonUpgradeCheck.Change in category_changes:
|
||||
labels.append(change.label)
|
||||
_check(labels.has("Pflichtelemente"), "the required elements are compared")
|
||||
_check(
|
||||
labels.has("Level-Grenzen (Pirouette/Sequenz)"),
|
||||
"the level caps are compared"
|
||||
)
|
||||
|
||||
|
||||
func _make_pair_routine() -> Routine:
|
||||
var routine := Routine.new()
|
||||
routine.routine_id = "season-pair"
|
||||
|
|
|
|||
|
|
@ -1756,6 +1756,41 @@ func _run() -> void:
|
|||
"an unknown season is rejected"
|
||||
)
|
||||
|
||||
# Saison-Upgrade-Prüfung: berichtet nur, ändert erst auf Bestätigung.
|
||||
controller.new_routine()
|
||||
controller.add_element_marker(
|
||||
Vector2(0.0, 0.0),
|
||||
PathSegment.ElementType.SPIN,
|
||||
"ChSp",
|
||||
1
|
||||
)
|
||||
controller.open_validation_dialog()
|
||||
controller._on_validation_meta_clicked("upgrade")
|
||||
_check(controller.upgrade_dialog.visible, "the upgrade dialog opens")
|
||||
_check(
|
||||
controller.validation_dialog.visible,
|
||||
"the check dialog stays open behind the comparison"
|
||||
)
|
||||
_check(
|
||||
controller.upgrade_text.text.contains("nicht im Katalog"),
|
||||
"the report names the element the target season lacks"
|
||||
)
|
||||
_check(
|
||||
not controller.upgrade_apply_button.disabled,
|
||||
"switching the season is offered after the check"
|
||||
)
|
||||
_check(
|
||||
controller.get_season() == "2026/27",
|
||||
"checking alone does not change the season"
|
||||
)
|
||||
controller._on_upgrade_apply_pressed()
|
||||
_check(
|
||||
controller.get_season() == "2025/26",
|
||||
"confirming switches the routine to the target season"
|
||||
)
|
||||
controller.upgrade_dialog.hide()
|
||||
controller.validation_dialog.hide()
|
||||
|
||||
controller.new_routine()
|
||||
|
||||
# Structured jump combination in the element dialog.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue