Fix notifications 500 (audit_id column), smart resolution time units
- notifications.php: audit_log PK is audit_id not log_id; alias all three queries with audit_id AS log_id to fix 500 error - DashboardView: avg resolution time now picks best unit automatically (min < 1h, hr < 48h, days < 14d, wks otherwise) with full hours shown in title tooltip; adds lt-stat-unit CSS for the suffix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+17
-2
@@ -162,10 +162,25 @@ include __DIR__ . '/layout_header.php';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lt-stat-card stat-time" title="Average resolution time" aria-label="Avg resolution time">
|
||||
<?php
|
||||
$avgHours = $stats['avg_resolution_hours'] ?? 0;
|
||||
if ($avgHours <= 0) {
|
||||
$avgDisplay = '—'; $avgUnit = '';
|
||||
} elseif ($avgHours < 1) {
|
||||
$avgDisplay = (string)max(1, (int)round($avgHours * 60)); $avgUnit = 'min';
|
||||
} elseif ($avgHours < 48) {
|
||||
$avgDisplay = (string)(int)round($avgHours); $avgUnit = 'hr';
|
||||
} elseif ($avgHours < 336) { // <14 days
|
||||
$avgDisplay = number_format($avgHours / 24, 1); $avgUnit = 'days';
|
||||
} else {
|
||||
$avgDisplay = number_format($avgHours / 168, 1); $avgUnit = 'wks';
|
||||
}
|
||||
$avgTitle = $avgHours > 0 ? number_format($avgHours, 1) . ' hours' : 'No data';
|
||||
?>
|
||||
<div class="lt-stat-card stat-time" title="Average resolution time: <?= htmlspecialchars($avgTitle) ?>" aria-label="Avg resolution time">
|
||||
<div class="lt-stat-icon lt-text-muted">⏱</div>
|
||||
<div class="lt-stat-info">
|
||||
<div class="lt-stat-value"><?= htmlspecialchars($stats['avg_resolution_hours'] ?? '—') ?>h</div>
|
||||
<div class="lt-stat-value"><?= htmlspecialchars($avgDisplay) ?><span class="lt-stat-unit"><?= $avgUnit ?></span></div>
|
||||
<div class="lt-stat-label">Avg Resolution</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user