Afia: fix transfer chat context querying nonexistent download_count
Deploy Ladill Transfer / deploy (push) Successful in 54s

context() selected/used download_count on the transfers table, but the
column is downloads_total (see model + migration) — every Afia chat 500'd
with 'could not respond' before reaching the LLM. Use downloads_total.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
isaacclad
2026-06-11 06:19:22 +00:00
co-authored by Claude Opus 4.8
parent dac231092b
commit 40bfae6fb6
+2 -2
View File
@@ -86,14 +86,14 @@ class AfiaController extends Controller
->with('qrCode:id,short_code')
->latest()
->limit(3)
->get(['id', 'title', 'qr_code_id', 'download_count', 'expires_at']);
->get(['id', 'title', 'qr_code_id', 'downloads_total', 'expires_at']);
if ($recent->isNotEmpty()) {
$ctx['recent_transfers'] = $recent->map(fn (Transfer $transfer): string => sprintf(
'%s (%s, %d downloads%s)',
$transfer->title,
$transfer->qrCode?->short_code ?? 'no QR',
$transfer->download_count,
$transfer->downloads_total,
$transfer->expires_at ? ', expires '.$transfer->expires_at->toDateString() : '',
))->implode('; ');
}