{% extends "layout.html" %} {% block content %}
Opportunities {{ model_name }}

Model

{{ model_name }}

{{ finding_count }} {{ "finding" if finding_count == 1 else "findings" }} on this model in project {{ config.name }}.

{# Aggregate summary strip #}

State

{% if worst_state == 'high_risk' %}High risk {% elif worst_state == 'failed' %}Failed {% elif worst_state == 'requires_review' %}Review {% elif worst_state == 'generating' %}Generating {% elif worst_state == 'upstream_fix' %}Upstream fix {% elif worst_state == 'safe' %}Safe {% elif worst_state == 'resolved' %}Resolved {% else %}Awaiting{% endif %}

Worst case across all findings on this model.

Total query cost

{% if total_cost is not none %}{{ total_cost | format_usd }}{% else %}—{% endif %}

Summed across {{ finding_count }} finding(s).

Total savings

{% if total_savings is not none and total_savings > 0 %}~{{ total_savings | format_usd }}{% else %}—{% endif %}

Estimated per-run savings across findings.

{# Findings list #}
{% for f in findings %}

{{ f.opportunity_type | replace('_', ' ') | title }}

Query cost: {% if f.current_cost_estimate is not none %}{{ f.current_cost_estimate | format_usd }}{% else %}—{% endif %} · Savings: {% if f.expected_savings is not none and f.expected_savings > 0 %}~{{ f.expected_savings | format_usd }}{% else %}—{% endif %} {% if f.last_detected_at %} · Last detected: {{ f.last_detected_at.strftime("%d/%m/%Y") }} {% endif %}
{# State pill — same vocab as the grouped list #} {% if f.state_key == 'high_risk' %} High risk {% elif f.state_key == 'failed' %} Failed {% elif f.state_key == 'requires_review' %} Review {% elif f.state_key == 'generating' %} Generating {% elif f.state_key == 'upstream_fix' %} Upstream fix {% elif f.state_key == 'safe' %} Safe {% elif f.state_key == 'resolved' %} Resolved {% else %} Awaiting {% endif %} Open finding →
{% endfor %}
{% endblock %}