{% extends "base.html" %} {% block title %}Inspector Performance{% endblock %} {% block extra_css %} {% endblock %} {% block content %} {# ── Sub-nav ── #} {# ── Header ── #}

Inspector Performance

{{ start.strftime('%b %d, %Y') }} — {{ end.strftime('%b %d, %Y') }}

{# ── Date filter ── #}
{% if selected_id %} {% endif %}
Reset
{% if not inspector_stats %}
No inspections found for the selected date range.
{% else %} {# ── Comparison charts ── #}
Avg Score by Inspector
Inspections Completed
{# ── Summary table ── #}
All Inspectors — Summary
{{ inspector_stats|length }} inspector{{ 's' if inspector_stats|length != 1 }}
{% for s in inspector_stats %} {% endfor %}
Inspector Total Completed Completion Rate Avg Score Issues Flagged Follow-ups Facilities
{{ s.display_name }} {{ s.total }} {{ s.completed }}
{{ s.completion_rate }}%
{% if s.avg_score %} {{ '%.1f'|format(s.avg_score) }}% {% else %} {% endif %} {% if s.issues_flagged > 0 %} {{ s.issues_flagged }} {% else %} 0 {% endif %} {% if s.follow_ups > 0 %} {{ s.follow_ups }} {% else %} 0 {% endif %} {{ s.facilities }} {% if selected_id == s.id %} Close {% else %} Details {% endif %}
{# ── Individual inspector drill-down ── #} {% if selected_inspector and selected_kpis %}
{{ selected_inspector.display_name }}
{# KPI stat row #}
{% for label, value, color, icon in [ ('Total Inspections', selected_kpis.total, 'primary', 'bi-clipboard-data'), ('Completed', selected_kpis.completed, 'success', 'bi-check-circle'), ('Avg Score', (('%.1f'|format(selected_kpis.avg_score)) + '%') if selected_kpis.avg_score else '—', 'info', 'bi-graph-up'), ('Issues Flagged', selected_kpis.issues_flagged, 'danger', 'bi-flag'), ('Follow-ups Req.', selected_kpis.follow_ups, 'warning', 'bi-arrow-repeat'), ('Facilities Covered', selected_kpis.facilities, 'primary', 'bi-building'), ] %}

{{ label }}

{{ value }}
{% endfor %}
{# Score trend chart #}
Score Trend — {{ selected_inspector.display_name }}
{% if trend_data %}
{% else %}

No completed inspections with scores in this period.

{% endif %}
{# Recent inspections #} {% if recent_inspections %}
Recent Inspections
{{ recent_inspections|length }}
{% for ins in recent_inspections %} {% endfor %}
Date Facility Area Template Score Status
{{ ins.inspection_date.strftime('%b %d, %Y') }} {{ ins.facility.name if ins.facility else '—' }} {{ ins.area.name if ins.area else '—' }} {{ ins.template.name if ins.template else '—' }} {% if ins.overall_score %} {{ '%.1f'|format(ins.overall_score|float) }}% {% else %}—{% endif %} {% set sc = ins.status %} {{ 'Submitted' if sc == 'completed' else sc.replace('_',' ')|title }} View
{% endif %}
{% endif %} {% endif %}{# end if inspector_stats #} {% endblock %} {% block extra_js %} {% endblock %}