QoL and metric value inverter

This commit is contained in:
2026-03-04 11:10:45 -06:00
parent 8dfe3607b1
commit f57ac7d6dc
30 changed files with 556 additions and 118 deletions

View File

@@ -80,7 +80,11 @@ def metric_add(domain_id: int):
if not metric_name:
flash("Metric name is required.", "error")
else:
mb = MetricBound(metric_name=metric_name, weight=weight, norm_min=norm_min, norm_max=norm_max, unit=unit)
lower_is_better = bool(request.form.get("lower_is_better"))
mb = MetricBound(
metric_name=metric_name, weight=weight, norm_min=norm_min,
norm_max=norm_max, unit=unit, lower_is_better=lower_is_better,
)
repo.add_metric_bound(domain_id, mb)
flash("Metric added.", "success")
domain = repo.get_domain_by_id(domain_id)
@@ -99,7 +103,8 @@ def metric_edit(domain_id: int, metric_id: int):
domain = repo.get_domain_by_id(domain_id)
return render_template("domains/_metrics_table.html", domain=domain)
unit = request.form.get("unit", "").strip()
repo.update_metric_bound(domain_id, metric_id, weight, norm_min, norm_max, unit)
lower_is_better = bool(request.form.get("lower_is_better"))
repo.update_metric_bound(domain_id, metric_id, weight, norm_min, norm_max, unit, lower_is_better)
flash("Metric updated.", "success")
domain = repo.get_domain_by_id(domain_id)
return render_template("domains/_metrics_table.html", domain=domain)

View File

@@ -54,6 +54,9 @@ def result_detail(domain_name: str, combo_id: int):
return redirect(url_for("results.results_domain", domain_name=domain_name))
result = repo.get_result(combo_id, domain.id)
if not result:
flash("No results for this combination in this domain.", "error")
return redirect(url_for("results.results_domain", domain_name=domain_name))
scores = repo.get_combination_scores(combo_id, domain.id)
return render_template(