{# Cohort view for /jobs/{destination_table}. Renders every cached execution of one BigQuery destination_table as a single page: cost-trend chart + Available improvements (latest version's suggestions only) + chronological Query versions list. See specs/146-audit-job-history-trend/. #} {% extends "layout.html" %} {% block content %}
Dashboard Jobs {{ view.destination_table }}

Job history

{{ view.destination_table }}

{{ view.total_executions }} execution{% if view.total_executions != 1 %}s{% endif %} across {{ view.versions | length }} query version{% if view.versions | length != 1 %}s{% endif %} · {{ view.days_with_executions }} day{% if view.days_with_executions != 1 %}s{% endif %} with executions

{# Stat strip — Total cost / Executions / Versions / Days. Mirrors the opportunity-detail stat-card layout for visual consistency. #}

Total Cost

{{ view.total_cost_usd | format_usd }}

summed across executions

Executions

{{ view.total_executions }}

Query Versions

{{ view.versions | length }}

{% if view.versions | length > 1 %}

{{ view.versions | length - 1 }} change{% if view.versions | length != 2 %}s{% endif %} in window

{% endif %}

Days with executions

{{ view.days_with_executions }}

{# Cost-trend chart — line + version-change scatter overlay. #} {% set chart_points_payload = view.chart_points_payload() %} {% include "jobs/_cost_chart.html" %} {# Available improvements — only the LATEST version's suggestions. Mirrors the same card stack /opportunities/{id} renders so the visual idiom + tab toggling stay identical. #}

Available improvements

{% if view.latest_suggestions %} {{ view.latest_suggestions | length }} for current version {% endif %}
{% if view.latest_suggestions %}

SQL-rewrite suggestions for the current query version (v{{ view.versions[-1].version_index }}). Earlier versions' suggestions don't render — see Query versions below for what was resolved.

{% for imp in view.latest_suggestions %}
{{ imp.display_name }} {% if imp.template_id %} deterministic rewrite {% endif %}
{% if imp.explanation %}

{{ imp.explanation }}

{% endif %} {% if imp.diff_lines or imp.before_content %}
{% if imp.diff_lines %} {% set diff_lines = imp.diff_lines %} {% set file_path = imp.template_id %} {% include "components/code_diff.html" %} {% else %}

No diff available — template did not produce a change.

{% endif %}
{% endif %} {% if imp.rollback %}
Rollback instructions

{{ imp.rollback }}

{% endif %}
{% endfor %}
{% else %}

No suggestions for the current query version. {% if view.versions | length > 1 %} Earlier versions may have had findings — see Query versions below for what was resolved. {% endif %}

{% endif %}
{# Query versions — chronological history of distinct query bodies. #}

Query versions

{{ view.versions | length }} in window

Each distinct query body BigQuery executed in this scan window. Click a chart marker above to drill into a specific execution.

{% for version in view.versions %} {% include "jobs/_version_card.html" %} {% endfor %}
{# Generic tab toggler — picks up any descendant with [data-tab] / [data-tab-pane] inside an ancestor that has [data-active-tab]. Works for both Available improvements (.audit-imp-card) and the version cards (.audit-version-card) without coupling to the class name. #} {% endblock %}