import requests def test_simplified_duplicates(): print("=== SIMPLIFIED DUPLICATE DISPLAY TEST ===") try: # Test the analyze endpoint response = requests.post('http://localhost:8081/analyze', json={'file_path': 'data/sample-data.xlsx'}, timeout=30) if response.status_code == 200: data = response.json() if data.get('success'): results = data['results'] print("✓ Analysis successful!") print(f" Matched items: {results['matched_items_count']}") print(f" KST only: {results['mismatches']['kst_only_count']}") print(f" Coordi only: {results['mismatches']['coordi_only_count']}") print(f" KST duplicates: {results['mismatches']['kst_duplicates_count']}") print(f" Coordi duplicates: {results['mismatches']['coordi_duplicates_count']}") # What the count will show total_count = (results['mismatches']['kst_only_count'] + results['mismatches']['coordi_only_count'] + results['mismatches']['kst_duplicates_count'] + results['mismatches']['coordi_duplicates_count']) # What the table will show table_rows = results['mismatches']['kst_only_count'] + results['mismatches']['coordi_only_count'] print(f"\n📊 DISPLAY LOGIC:") print(f" Count badge shows: {total_count} items (all different items)") print(f" Table shows: {table_rows} rows (only KST-only + Coordi-only)") print(f" Yellow highlights: Items that are also duplicates") # Check for 백라이트 example kst_only = results['mismatch_details']['kst_only'] kst_duplicates = results['mismatch_details']['kst_duplicates'] backlight_kst_only = [item for item in kst_only if '백라이트' in item['title'] and '53-1x' in item['episode']] backlight_kst_dup = [item for item in kst_duplicates if '백라이트' in item['title'] and '53-1x' in item['episode']] if backlight_kst_only and backlight_kst_dup: print(f"\n✓ 백라이트 example works:") print(f" - Appears in table (KST-only): YES") print(f" - Will be highlighted yellow: YES (also duplicate)") print(f" - Contributes to count: 2 items (1 KST-only + 1 duplicate)") print(f"\n✓ Web interface ready at http://localhost:8081") print("✓ Check the 'Different' tab:") print(" - Count shows all different items") print(" - Table shows only KST-only + Coordi-only") print(" - Yellow rows = items that also have duplicates") else: print(f"✗ Analysis failed: {data.get('error')}") else: print(f"✗ Request failed: {response.status_code}") except requests.exceptions.RequestException as e: print(f"✗ Request failed: {e}") if __name__ == "__main__": test_simplified_duplicates()