{% extends "base.html" %} {% block title %}{{ facility.name }} — Facility Report{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{{ facility.name }}

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

Export CSV Back to Reports
{# KPI row #} {% set completed = inspections | selectattr('status','eq','completed') | list %} {% set avg = (completed | map(attribute='overall_score') | select | list) %}

Total Inspections

{{ inspections|length }}

Completed

{{ completed|length }}

Open Issues

{{ open_issues|length }}

Avg Score

{% if avg %} {% set avg_val = (avg | map('float') | sum) / avg|length %}

{{ '%.1f'|format(avg_val) }}%

{% else %}

{% endif %}
{# Area scores chart #} {% if area_scores %}
Avg Score by Area
{% endif %} {# Inspection history #}
Inspection History
{% if inspections %} {% for ins in inspections %} {% endfor %}
DateAreaTemplateInspectorScoreStatus
{{ ins.inspection_date.strftime('%Y-%m-%d %H:%M') }} {{ ins.area.name if ins.area else '—' }} {{ ins.template.name }} {{ ins.inspector.display_name }} {% if ins.overall_score %} {{ ins.overall_score }}% {% else %}—{% endif %} {{ ins.status|replace('_',' ')|title }} View
{% else %}

No inspections in this date range.

{% endif %}
{# Open issues #} {% if open_issues %}
Open Issues
{% for issue in open_issues %} {% endfor %}
SeverityAreaDescriptionReported
{{ issue.severity|title }} {{ issue.area.name }} {{ issue.description[:60] }}{% if issue.description|length > 60 %}…{% endif %} {{ issue.reported_at.strftime('%Y-%m-%d') }} View
{% endif %} {% endblock %} {% block extra_js %} {% if area_scores %} {% endif %} {% endblock %}