feat: Basiswert-Schaetzung im Pruefdialog

- ValidationReport summiert Base Values und zaehlt gewertete sowie nicht
  gewertete Elemente
- Wertungsliste pro Element inkl. nicht gewerteter Freitext-Codes
- Dialog zeigt Basiswert, Zaehler, Caveat und Wertungsliste
- 63 Validierungs- und 262 Whiteboard-Assertions (930 gesamt)
- Doku, Findings und Roadmap aktualisiert
This commit is contained in:
torsten 2026-10-31 10:55:27 +01:00
parent 15f7eab9cf
commit 334603c810
9 changed files with 230 additions and 9 deletions

View file

@ -50,10 +50,35 @@ func validate_report(routine: Routine) -> ValidationReport:
report.element_count += 1
_validate_segment(segment, section.section_id, report)
_collect_program_features(segment, section.section_id, seen_once, report)
_collect_base_value(segment, section.section_id, report)
return report
func _collect_base_value(
segment: PathSegment,
section_id: String,
report: ValidationReport
) -> void:
var value := _catalog.get_segment_base_value(segment)
var label := segment.get_element_caption()
if label.is_empty():
label = PathSegment.element_type_name(segment.element_type)
report.element_values.append(
{
"section_id": section_id,
"segment_id": segment.segment_id,
"label": label,
"value": value,
}
)
if value < 0.0:
report.unscored_elements += 1
return
report.base_value_total += value
report.scored_elements += 1
func _validate_segment(
segment: PathSegment,
section_id: String,

View file

@ -29,6 +29,10 @@ const CHECK_LABELS := {
var issues: Array[ValidationIssue] = []
var element_count: int = 0
var section_count: int = 0
var base_value_total: float = 0.0
var scored_elements: int = 0
var unscored_elements: int = 0
var element_values: Array[Dictionary] = []
var checks: Array[ValidationCheck] = []

View file

@ -476,6 +476,32 @@ func open_validation_dialog() -> void:
]
)
lines.append("")
lines.append(
"[b]Basiswert: %s[/b]" % _format_base_value(report.base_value_total)
)
var scored_text := (
"%d von %d Elementen gewertet"
% [report.scored_elements, report.element_count]
)
if report.unscored_elements > 0:
scored_text += " · %d ohne Base Value" % report.unscored_elements
lines.append(scored_text)
lines.append(
"[color=#94a3b8]Nur Base Values: ohne GOE, 1,1-Faktor, Komponenten und Abzüge.[/color]"
)
if not report.element_values.is_empty():
lines.append("")
lines.append("[b]Wertung[/b]")
for entry: Dictionary in report.element_values:
var value: float = entry["value"]
var value_text := (
"—" if value < 0.0 else _format_base_value(value)
)
lines.append(
"%s — %s"
% [_escape_bbcode(str(entry["label"])), value_text]
)
lines.append("")
lines.append("[b]Prüfungen[/b]")
for check: ValidationCheck in report.checks:
lines.append(_validation_check_line(check))
@ -611,6 +637,10 @@ static func _escape_bbcode(text: String) -> String:
return text.replace("[", "[lb]")
static func _format_base_value(value: float) -> String:
return ("%.2f" % value).replace(".", ",")
func get_selected_element_features() -> PackedStringArray:
var segment := get_selected_segment()
if segment == null:

View file

@ -93,6 +93,17 @@ func _test_clean_routine() -> void:
)
_check(report.get_check("level_features").passed == 2, "both derived levels match")
_check(report.get_check("once").passed == 6, "once-per-program features were checked")
_check_approx(
report.base_value_total,
7.40,
"the report sums the base values (3.50 + 3.90)"
)
_check(report.scored_elements == 2, "both elements were scored")
_check(report.unscored_elements == 0, "no element is unscored")
_check(
report.element_values.size() == 2,
"the report keeps one value entry per element"
)
func _test_unknown_code() -> void:
@ -110,6 +121,13 @@ func _test_unknown_code() -> void:
report.get_check("type").is_skipped(),
"the type check is skipped without a definition"
)
_check(report.unscored_elements == 1, "an unknown code has no base value")
_check(report.base_value_total == 0.0, "an unknown code adds no points")
_check(
report.element_values.size() == 1
and float(report.element_values[0]["value"]) < 0.0,
"the score entry marks the unknown code as unscored"
)
func _test_type_mismatch() -> void:
@ -176,6 +194,11 @@ func _test_jump_level_and_features() -> void:
report.get_check("features").warnings == 1,
"the feature check records the jump warning"
)
_check_approx(
report.base_value_total,
5.90,
"the jump contributes its base value despite the level warning"
)
func _test_fixed_level() -> void:
@ -205,6 +228,7 @@ func _test_fixed_level() -> void:
)
_check(valid.issues.is_empty(), "ChSq at Level 1 is valid")
_check(valid.get_check("fixed_level").passed == 1, "the fixed-level check passes")
_check_approx(valid.base_value_total, 3.00, "ChSq contributes 3.00")
func _test_missing_code() -> void:
@ -431,6 +455,13 @@ func _check(condition: bool, message: String) -> void:
_failures.append(message)
func _check_approx(actual: float, expected: float, message: String) -> void:
_check(
absf(actual - expected) <= 0.001,
"%s (expected %.3f, got %.3f)" % [message, expected, actual]
)
func _finish() -> void:
if _failures.is_empty():
print("PASS: %d assertions" % _assertions)

View file

@ -1268,6 +1268,17 @@ func _run() -> void:
),
"skipped checks explain why they do not apply"
)
_check(
controller.validation_text.text.contains("Basiswert")
and controller.validation_text.text.contains("0,00")
and controller.validation_text.text.contains("1 ohne Base Value"),
"validation dialog shows the base-value total and unscored count"
)
_check(
controller.validation_text.text.contains("Wertung")
and controller.validation_text.text.contains("3X — —"),
"the scoring breakdown marks unknown elements as unscored"
)
controller.validation_dialog.hide()
controller.new_routine()
@ -1289,6 +1300,11 @@ func _run() -> void:
and controller.validation_text.text.contains("1/1"),
"clean validation lists the passed checks"
)
_check(
controller.validation_text.text.contains("Basiswert")
and controller.validation_text.text.contains("1,70"),
"clean validation shows the base value of a Base spin"
)
controller.validation_dialog.hide()
scene.queue_free()