perbaikan LOAD usage memperingan penggunaan

This commit is contained in:
Fanrouver
2026-05-18 09:22:47 +07:00
parent 2bf00eff3c
commit cb3310b44b
6 changed files with 88 additions and 299 deletions

No files matched your search

+1 -45
View File
@@ -2439,11 +2439,8 @@ const stopScanning = async () => {
};
const handleQRScanSuccess = (decodedText: string) => {
console.log("🎯 QR Scan Success! Data:", decodedText);
// Guard: Jika sedang proses atau dialog sedang terbuka, abaikan scan
if (isProcessingScan.value || infoDialog.value) {
console.log("⏭️ Scan diabaikan: Sedang memproses atau dialog terbuka");
return;
}
@@ -3015,20 +3012,14 @@ const onDetect = async (decodedText: string) => {
// 2. Format testing: "patientId|status" (contoh: P-00001|ALLOWED)
// Status akan dicek real-time dari queueStore saat scan QR
console.log("🔍 onDetect called with QR data:", decodedText);
// Extract barcode/patientId dari QR data (handle format testing dengan pipe)
const qrData = extractQRData(decodedText);
const searchBarcode = qrData.barcode; // Barcode/patientId untuk dicari di queueStore
const searchBarcode = qrData.barcode;
// Clean input - remove whitespace and normalize
const cleanInput = String(searchBarcode).trim();
const cleanInputUpper = cleanInput.toUpperCase();
console.log("🔍 Extracted barcode/patientId:", searchBarcode);
console.log("🔍 Cleaned input:", cleanInput);
console.log("📊 Total patients in store:", queueStore.allPatients.length);
// IMPORTANT: Hanya cari dengan EXACT barcode match untuk menghindari false positive
// Format barcode: YYMMDD + 5 digit (contoh: 26011500001)
// Jangan gunakan fallback ke noAntrian atau no karena bisa menyebabkan false positive
@@ -3045,12 +3036,6 @@ const onDetect = async (decodedText: string) => {
patientBarcode === cleanInput ||
patientBarcode.toLowerCase() === cleanInput.toLowerCase()
) {
console.log(
"✅ Found by exact barcode match:",
patientBarcode,
"===",
cleanInput,
);
return true;
}
@@ -3148,13 +3133,6 @@ const onDetect = async (decodedText: string) => {
const klinikQueueNumber =
freshPatient.noAntrian?.split(" |")[0] || freshPatient.noAntrian || "N/A";
console.log("🔍 Fresh patient status:", {
barcode: freshPatient.barcode,
noAntrian: freshPatient.noAntrian,
status: patientStatus,
processStage: freshPatient.processStage,
});
// Cek apakah sudah check-in (status === 'di-loket') - gunakan data fresh
if (patientStatus === "di-loket") {
// Sudah check-in sebelumnya
@@ -3230,16 +3208,6 @@ const onDetect = async (decodedText: string) => {
// Gunakan barcode pasien yang fresh, bukan decodedText (untuk memastikan format benar)
const patientBarcodeForCheckIn =
freshPatient.barcode || searchBarcode || decodedText;
console.log(
"🔍 Calling checkInPatient with barcode (fresh):",
patientBarcodeForCheckIn,
);
console.log(
"🔍 Original QR data:",
decodedText,
"| Extracted barcode:",
searchBarcode,
);
const checkInResult = await queueStore.checkInPatient(
patientBarcodeForCheckIn,
);
@@ -3381,12 +3349,6 @@ const checkInManual = async () => {
const cleanInputUpper = cleanInput.toUpperCase();
const originalInput = inputValue.toUpperCase().trim();
console.log("🔍 checkInManual called with:", inputValue);
console.log("🔍 Extracted barcode/patientId:", searchBarcode);
console.log("🔍 Cleaned input:", cleanInput);
console.log("🔍 Original input:", originalInput);
console.log("📊 Total patients in store:", queueStore.allPatients.length);
let foundPatient: any = null;
let freshPatient: any = null;
@@ -3405,12 +3367,6 @@ const checkInManual = async () => {
patientBarcode === cleanInput ||
patientBarcode.toLowerCase() === cleanInput.toLowerCase()
) {
console.log(
"✅ Found by exact barcode match:",
patientBarcode,
"===",
cleanInput,
);
return true;
}