Subversion Repositories SmartDukaan

Rev

Rev 1915 | Rev 4129 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1915 Rev 2655
Line 1... Line 1...
1
def getscore(struct) :
1
def getscore(struct) :
2
    
2
    
3
    score = 0.0
3
    score = 0.0
-
 
4
    
-
 
5
    category = struct.get("category")
4
 
6
    
5
    if struct.has_key("features") :
7
    if struct.has_key("features") :
6
        features = struct.get("features")
8
        features = struct.get("features")
-
 
9
        
-
 
10
        if category == "Tablets" :
-
 
11
 
-
 
12
            # GPRS : 1, 0
-
 
13
            if features.has_key("GPRS") :
-
 
14
                score += 10*10
-
 
15
    
-
 
16
            # EDGE : 1, 0
-
 
17
            if features.has_key("EDGE") :
-
 
18
                score += 10*10
-
 
19
            
-
 
20
            # 3G : 2, 0
-
 
21
            if features.has_key("3G") :
-
 
22
                score += 10*10
-
 
23
            
-
 
24
            # WLAN : 2, 0
-
 
25
            if features.has_key("Wi-Fi") :
-
 
26
                score += 10*10
-
 
27
            
-
 
28
            # Bluetooth : 1, 0
-
 
29
            if features.has_key("Bluetooth") :
-
 
30
                score += 10*10
-
 
31
             
-
 
32
            # USB : 1, 0
-
 
33
            if features.has_key("USB") :
-
 
34
                score += 10*10
-
 
35
            
-
 
36
            # USB Port: 1, 0
-
 
37
            if features.has_key("USB port") :
-
 
38
                score += 10*10
7
    
39
    
-
 
40
            # USB Port: 1, 0
-
 
41
            if features.has_key("Docking port") :
-
 
42
                score += 10*10
-
 
43
                
-
 
44
            # HDMI Port: 1, 0
-
 
45
            if features.has_key("HDMI port") :
-
 
46
                score += 10*10
-
 
47
            
-
 
48
            # Card slot: 1, 0
-
 
49
            if features.has_key("Card slot") :
-
 
50
                score += 10*10
-
 
51
                                
-
 
52
 
-
 
53
        else:
8
        # GPRS : 1, 0
54
            # GPRS : 1, 0
9
        if features.has_key("GPRS") :
55
            if features.has_key("GPRS") :
10
            score += 10*20
56
                score += 10*20
-
 
57
    
-
 
58
            # EDGE : 1, 0
-
 
59
            if features.has_key("EDGE") :
-
 
60
                score += 10*10
-
 
61
            
-
 
62
            # 3G : 2, 0
-
 
63
            if features.has_key("3G") :
-
 
64
                score += 10*25
-
 
65
            
-
 
66
            # WLAN : 2, 0
-
 
67
            if features.has_key("Wi-Fi") :
-
 
68
                score += 10*25
-
 
69
            
-
 
70
            # Bluetooth : 1, 0
-
 
71
            if features.has_key("Bluetooth") :
-
 
72
                score += 10*10
-
 
73
             
-
 
74
            # USB : 1, 0
-
 
75
            if features.has_key("USB") :
-
 
76
                score += 10*10
11
 
77
 
12
        # EDGE : 1, 0
-
 
13
        if features.has_key("EDGE") :
-
 
14
            score += 10*10
-
 
15
        
-
 
16
        # 3G : 2, 0
-
 
17
        if features.has_key("3G") :
-
 
18
            score += 10*25
-
 
19
        
-
 
20
        # WLAN : 2, 0
-
 
21
        if features.has_key("WLAN") :
-
 
22
            score += 10*25
-
 
23
        
-
 
24
        # Bluetooth : 1, 0
-
 
25
        if features.has_key("Bluetooth") :
-
 
26
            score += 10*10
-
 
27
         
-
 
28
        # USB : 1, 0
-
 
29
        if features.has_key("USB") :
-
 
30
            score += 10*10
-
 
31
        
-
 
32
        score = score / 100
78
        score = score / 100
33
    return score        
79
    return score