Aug 7 - Update remove the dashboard inspector activity

This commit is contained in:
2026-08-07 13:17:00 -04:00
parent 4db06b6139
commit 1741c194f2
4 changed files with 2 additions and 130 deletions
+2 -1
View File
@@ -20,7 +20,8 @@
"Bash(python -c \"import ast;ast.parse\\(open\\('app/enrollment/routes.py',encoding='utf-8'\\).read\\(\\)\\);print\\('parses OK'\\)\")", "Bash(python -c \"import ast;ast.parse\\(open\\('app/enrollment/routes.py',encoding='utf-8'\\).read\\(\\)\\);print\\('parses OK'\\)\")",
"Bash(python -c \"import ast;[ast.parse\\(open\\(f,encoding='utf-8'\\).read\\(\\)\\) for f in ['app/enrollment/mailer.py','app/enrollment/schema.py']];print\\('parses OK'\\)\")", "Bash(python -c \"import ast;[ast.parse\\(open\\(f,encoding='utf-8'\\).read\\(\\)\\) for f in ['app/enrollment/mailer.py','app/enrollment/schema.py']];print\\('parses OK'\\)\")",
"Bash(python -c \"import ast;ast.parse\\(open\\('app/enrollment/mailer.py',encoding='utf-8'\\).read\\(\\)\\);print\\('parses OK'\\)\")", "Bash(python -c \"import ast;ast.parse\\(open\\('app/enrollment/mailer.py',encoding='utf-8'\\).read\\(\\)\\);print\\('parses OK'\\)\")",
"Bash(grep -n \"\\\\\\\\\\\\\\\\n\" app/enrollment/mailer.py)" "Bash(grep -n \"\\\\\\\\\\\\\\\\n\" app/enrollment/mailer.py)",
"Bash(git stash *)"
] ]
} }
} }
-33
View File
@@ -331,38 +331,6 @@ def index():
unassigned_open = len(unassigned_all) unassigned_open = len(unassigned_all)
unassigned_handler = _handler_split(unassigned_all) unassigned_handler = _handler_split(unassigned_all)
# ── Inspector activity today (admin / director / PM / auditor only) ───────
inspector_activity = []
if is_privileged or is_project_manager or is_auditor:
active_inspectors = (
User.query
.filter(User.role.in_(User.INSPECTOR_ROLES), User.active == True)
.order_by(User.full_name, User.username)
.all()
)
today_counts = dict(
db.session.query(
Inspection.inspector_id,
func.count(Inspection.id),
)
.filter(
Inspection.status == 'completed',
Inspection.inspection_date >= today_start,
Inspection.inspection_date < today_end,
)
.group_by(Inspection.inspector_id)
.all()
)
inspector_activity = sorted(
[{'name': u.display_name,
'count': today_counts.get(u.id, 0),
# phase49 — flags customer / third-party inspectors so the table
# can badge them; internal and external are listed together.
'external': u.is_external_inspector}
for u in active_inspectors],
key=lambda x: (-x['count'], x['name']),
)
# ── My open issues (inspector dashboard widget) ─────────────────────────── # ── My open issues (inspector dashboard widget) ───────────────────────────
# Issues assigned to the current inspector that are not yet resolved, # Issues assigned to the current inspector that are not yet resolved,
# ordered by SLA urgency (breached first, then at-risk, then ok). # ordered by SLA urgency (breached first, then at-risk, then ok).
@@ -422,7 +390,6 @@ def index():
stale_in_progress = stale_in_progress, stale_in_progress = stale_in_progress,
unassigned_open = unassigned_open, unassigned_open = unassigned_open,
unassigned_handler = unassigned_handler, unassigned_handler = unassigned_handler,
inspector_activity = inspector_activity,
recent_inspections = recent_inspections, recent_inspections = recent_inspections,
total_facilities = total_facilities, total_facilities = total_facilities,
total_templates = total_templates, total_templates = total_templates,
-47
View File
@@ -294,53 +294,6 @@
{# ── Inspector activity today (admin / director / PM) ───────────────────── #}
{% if inspector_activity %}
<div class="card shadow-sm mb-4">
<div class="card-header bg-light d-flex justify-content-between align-items-center">
<span class="fw-semibold"><i class="bi bi-people me-1"></i>Inspector Activity Today</span>
<a href="{{ url_for('inspections.index', date_from=today_str, date_to=today_str) }}"
class="btn btn-sm btn-outline-secondary">View all</a>
</div>
<div class="card-body p-0">
<table class="table table-sm table-hover mb-0" style="font-size:.85rem;">
<thead class="table-light">
<tr>
<th>Inspector</th>
<th class="text-center" style="width:120px;">Submitted Today</th>
<th style="width:200px;"></th>
</tr>
</thead>
<tbody>
{% for row in inspector_activity %}
<tr class="{{ 'table-success' if row.count > 0 else '' }}">
<td>{{ row.name }}
{% if row.external %}
<span class="badge bg-dark ms-1" title="Customer / third-party inspector">External</span>
{% endif %}
</td>
<td class="text-center">
{% if row.count > 0 %}
<span class="badge bg-success">{{ row.count }}</span>
{% else %}
<span class="text-muted"></span>
{% endif %}
</td>
<td>
<div class="progress" style="height:6px;margin-top:4px;">
{% set max_count = inspector_activity | map(attribute='count') | max %}
{% set pct = (row.count / max_count * 100) | int if max_count > 0 else 0 %}
<div class="progress-bar bg-success" style="width:{{ pct }}%;"></div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{# ── My open issues (inspector widget) ──────────────────────────────────── #} {# ── My open issues (inspector widget) ──────────────────────────────────── #}
{% if my_issues %} {% if my_issues %}
<div class="card shadow-sm mb-4"> <div class="card shadow-sm mb-4">
-49
View File
@@ -280,55 +280,6 @@
{% endif %} {% endif %}
</div> </div>
{# ── Inspector activity today (admin / director / PM) ─────────────────── #}
{% if inspector_activity %}
<div class="jqc-card">
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="jqc-card-title mb-0">
<span class="jqc-tile-icon"><i class="bi bi-people"></i></span>Inspector Activity Today
</div>
<a href="{{ url_for('inspections.index', date_from=today_str, date_to=today_str) }}"
class="btn btn-sm btn-outline-primary">View all</a>
</div>
<div class="jqc-table-wrap table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Inspector</th>
<th class="text-center" style="width:150px;">Submitted Today</th>
<th style="width:220px;"></th>
</tr>
</thead>
<tbody>
{% for row in inspector_activity %}
<tr>
<td>{{ row.name }}
{% if row.external %}
<span class="badge bg-dark ms-1" title="Customer / third-party inspector">External</span>
{% endif %}
</td>
<td class="text-center">
{% if row.count > 0 %}
<span class="badge bg-success">{{ row.count }}</span>
{% else %}
<span class="text-muted"></span>
{% endif %}
</td>
<td>
<div class="progress" style="height:6px;">
{% set max_count = inspector_activity | map(attribute='count') | max %}
{% set pct = (row.count / max_count * 100) | int if max_count > 0 else 0 %}
<div class="progress-bar bg-success" style="width:{{ pct }}%;"></div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{# ── My open issues (inspector widget) ────────────────────────────────── #} {# ── My open issues (inspector widget) ────────────────────────────────── #}
{% if my_issues %} {% if my_issues %}
<div class="jqc-card"> <div class="jqc-card">