File size: 2,256 Bytes
8024c76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
"""
Test script to verify analytics are loading after config fix
"""

import sys
import os

# Add the project root to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

def test_config_import():
    """Test if config.settings can be imported"""
    print("πŸ” Testing config.settings import...")
    try:
        from config.settings import Config
        print("βœ… Config import successful")
        return True
    except Exception as e:
        print(f"❌ Config import failed: {e}")
        return False

def test_analytics_import():
    """Test if analytics modules can be imported"""
    print("πŸ” Testing analytics import...")
    try:
        from src.analysis.comprehensive_analytics import ComprehensiveAnalytics
        print("βœ… Analytics import successful")
        return True
    except Exception as e:
        print(f"❌ Analytics import failed: {e}")
        return False

def test_app_analytics():
    """Test if the app can load analytics"""
    print("πŸ” Testing app analytics loading...")
    try:
        # Import the app's analytics loading function
        import frontend.app as app
        
        # Check if analytics are available
        if hasattr(app, 'ANALYTICS_AVAILABLE'):
            print(f"βœ… Analytics available: {app.ANALYTICS_AVAILABLE}")
            return app.ANALYTICS_AVAILABLE
        else:
            print("❌ ANALYTICS_AVAILABLE not found in app")
            return False
    except Exception as e:
        print(f"❌ App analytics test failed: {e}")
        return False

if __name__ == "__main__":
    print("πŸ§ͺ Testing Analytics Fix")
    print("=" * 50)
    
    config_ok = test_config_import()
    analytics_ok = test_analytics_import()
    app_analytics_ok = test_app_analytics()
    
    print("\nπŸ“Š Results:")
    print(f"Config Import: {'βœ…' if config_ok else '❌'}")
    print(f"Analytics Import: {'βœ…' if analytics_ok else '❌'}")
    print(f"App Analytics: {'βœ…' if app_analytics_ok else '❌'}")
    
    if config_ok and analytics_ok and app_analytics_ok:
        print("\nπŸŽ‰ All tests passed! Analytics should be working.")
    else:
        print("\n⚠️ Some tests failed. Analytics may not be fully functional.")