This commit is contained in:
Ross
2025-12-14 22:08:30 +00:00
parent 55df9da8cb
commit 792349b2ea
3 changed files with 97 additions and 22 deletions
+18 -1
View File
@@ -422,7 +422,24 @@ def rota_run_detail(request, run_id):
from .models import RotaRun
run = get_object_or_404(RotaRun, pk=run_id)
return render(request, "rota/rota_run_detail.html", {"run": run})
# Prepare a pretty-printed JSON representation of the result for easier
# debugging in templates. Also expose any builder HTML present in the
# persisted `export_html` or embedded in the `result` under
# `builder_html` so it can be viewed inline.
result_pretty = None
builder_html = None
try:
if run.result is not None:
import json as _json
result_pretty = _json.dumps(run.result, indent=2, default=str)
# prefer persisted export_html if present
builder_html = getattr(run, "export_html", None) or (run.result.get("builder_html") if isinstance(run.result, dict) else None)
else:
builder_html = getattr(run, "export_html", None)
except Exception:
result_pretty = str(run.result)
return render(request, "rota/rota_run_detail.html", {"run": run, "result_pretty": result_pretty, "builder_html": builder_html})
def rota_run_export_html(request, run_id):