{% if groups and groups | length > 0 %}
{% for group in groups %}
{{ group.group_name | replace('_', ' ') | lower }} {{ group.opportunity_count }}
{{ group.opportunity_count }} issue{{ 's' if group.opportunity_count != 1 else '' }} {% if group.total_savings is defined and group.total_savings %} {{ group.total_savings | format_usd }} potential {% endif %}
{% for opp in group.opportunities %} {% endfor %}
Project Type Table Workload Impact Query Cost Optimized Cost Solution
{{ opp.project_name }} {{ opp.opportunity_type | replace('_', ' ') }} {{ opp.dbt_model_name if opp.dbt_model_name else (opp.affected_table.split('.')[-1] if '.' in opp.affected_table else opp.affected_table) }} {% if opp.query_workload_kind == 'build' %} Build {% elif opp.query_workload_kind == 'consumption' %} Consumption {% elif local_runtime_mode %} Unclassified {% else %} Query {% endif %}
{% if opp.severity_score >= 70 %} High {% elif opp.severity_score >= 40 %} Medium {% else %} Low {% endif %}
{% if opp.query_cost_value is not none %}
{{ opp.query_cost_value | format_usd }} {{ opp.query_cost_source_label }}
{% else %} {% endif %}
{% if opp.optimized_cost_value is not none %}
{{ opp.optimized_cost_value | format_usd }} {% if opp.optimized_delta_direction == 'down' %} {% elif opp.optimized_delta_direction == 'up' %} {% endif %}
{{ opp.optimized_cost_source_label }}
{% elif opp.solution_job_status in ('queued', 'in_progress') %}
Generating Solution {{ 'running' if opp.solution_job_status == 'in_progress' else 'queued' }}
{% elif opp.possible_savings_value is not none %}
~{{ opp.possible_savings_value | format_usd }}
{{ opp.possible_savings_label }}
{% else %} {% endif %}
{% if opp.solution_risk_level == 'low' %} Safe {% elif opp.solution_risk_level == 'medium' %} Review {% elif opp.solution_risk_level == 'high' %} High risk {% elif opp.solution_job_status in ('queued', 'in_progress') %} {{ 'Running' if opp.solution_job_status == 'in_progress' else 'Queued' }} {% else %} Pending {% endif %}
{% endfor %}
{% else %}

No opportunities match your filters

{% endif %}