From 5c3abb359560b3b78590a90be7c52c7f876f310c Mon Sep 17 00:00:00 2001 From: Santserrano Date: Mon, 17 Nov 2025 13:26:45 -0300 Subject: [PATCH] updates --- .../components/qr-scanner-free-event.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/next-frontend/components/qr-scanner-free-event.tsx b/apps/next-frontend/components/qr-scanner-free-event.tsx index 44a5265..1b28d2a 100644 --- a/apps/next-frontend/components/qr-scanner-free-event.tsx +++ b/apps/next-frontend/components/qr-scanner-free-event.tsx @@ -202,24 +202,24 @@ export function QRScannerFreeEvent({ eventoid }: ScannerFreeEventProps) { }, []); const handleScan = async (codigo: string) => { - const trimmedCode = codigo.trim(); - if (!trimmedCode || isProcessingScanRef.current) { + const normalizedCode = codigo.trim().toUpperCase(); + if (!normalizedCode || isProcessingScanRef.current) { return; } const now = Date.now(); const lastScan = lastScanRef.current; - if (lastScan && lastScan.code === trimmedCode && now - lastScan.timestamp < 2000) { + if (lastScan && lastScan.code === normalizedCode && now - lastScan.timestamp < 5000) { return; } - lastScanRef.current = { code: trimmedCode, timestamp: now }; + lastScanRef.current = { code: normalizedCode, timestamp: now }; isProcessingScanRef.current = true; setManualCode(''); try { - const data = await validateQrMutation.mutateAsync(trimmedCode); + const data = await validateQrMutation.mutateAsync(normalizedCode); if (data?.data?.validado) { const esYaValidado = data.message?.includes('ya fue validado'); @@ -236,6 +236,7 @@ export function QRScannerFreeEvent({ eventoid }: ScannerFreeEventProps) { } catch (error) { const message = error instanceof Error ? error.message : 'Error al validar código QR'; toast.error(message); + lastScanRef.current = { code: normalizedCode, timestamp: Date.now() }; // evitar reintentos instantáneos } finally { isProcessingScanRef.current = false; if (inputRef.current) {