QoL and metric value inverter
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user