From 5c65a5af898916693d7ef5e72789c72f010c8023 Mon Sep 17 00:00:00 2001 From: Aherobo Ovie Victor Date: Fri, 11 Jul 2025 22:41:15 +0100 Subject: [PATCH] Fix test results behavior - remove summary from upload results and hide tests on new image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Fixed Summary Message Placement: - Removed summary message from custom upload results (displayResults function) - Keep dynamic message only in 'Run All Tests' results - Upload results now show only detection stats and details ✅ Hide Test Results on New Image: - Test results automatically hidden when new image is uploaded - Test results hidden when file upload is reset - User must click 'Run All Tests' again to see results for new image ✅ Improved User Experience: - Clear separation between upload results and test results - Dynamic messages only appear where expected (Run All Tests) - Clean workflow: upload → test results disappear → click test → see results - No confusing duplicate summary messages ✅ Behavior Flow: 1. Upload image → No summary message in upload results 2. Click 'Run All Tests' → Shows '✅ Found X memory modules' or '❌ No memory modules' 3. Upload new image → Test results disappear automatically 4. Click 'Run All Tests' again → Fresh results with dynamic message Perfect test results behavior as requested --- static/script.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/static/script.js b/static/script.js index 18d2d1b..56096e5 100644 --- a/static/script.js +++ b/static/script.js @@ -185,6 +185,12 @@ function handleFile(file) { uploadedFile = file; + // Hide test results when new image is uploaded + const testResultsSection = document.getElementById('testResultsSection'); + if (testResultsSection) { + testResultsSection.style.display = 'none'; + } + // Show file info with change file option const uploadArea = document.getElementById('uploadArea'); uploadArea.innerHTML = ` @@ -231,6 +237,12 @@ function resetFileUpload() { // Hide results if showing document.getElementById('resultsSection').style.display = 'none'; + // Hide test results when file is reset + const testResultsSection = document.getElementById('testResultsSection'); + if (testResultsSection) { + testResultsSection.style.display = 'none'; + } + // Reinitialize the upload area with fresh event listeners initializeUploadArea(); @@ -316,18 +328,6 @@ function displayResults(result, title) { const resultsSection = document.getElementById('resultsSection'); const resultsContent = document.getElementById('resultsContent'); - // Create smart summary message - let summaryMessage = ''; - if (result.success) { - if (result.num_detections > 0) { - summaryMessage = `
✅ Found ${result.num_detections} memory modules
`; - } else { - summaryMessage = `
❌ No memory modules
`; - } - } else { - summaryMessage = `
❌ Error: ${result.error}
`; - } - let detectionsHtml = ''; if (result.detections && result.detections.length > 0) { detectionsHtml = result.detections.map((detection, index) => ` @@ -347,8 +347,6 @@ function displayResults(result, title) { ${new Date().toLocaleTimeString()} - ${summaryMessage} -
${result.num_detections}