Subversion Repositories SmartDukaan

Rev

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

Rev 323 Rev 1915
Line 1... Line 1...
1
def getscore(struct) :
1
def getscore(struct) :
2
    
2
    
3
    score = 0
3
    score = 0.0
4
    
4
 
5
    if struct.has_key("features") :
5
    if struct.has_key("features") :
6
        features = struct.get("features")
6
        features = struct.get("features")
7
    
7
    
8
        # GPRS : 1, 0
8
        # GPRS : 1, 0
9
        if features.has_key("GPRS") :
9
        if features.has_key("GPRS") :
10
            score += 1
10
            score += 10*20
11
 
11
 
12
        # EDGE : 1, 0
12
        # EDGE : 1, 0
13
        if features.has_key("EDGE") :
13
        if features.has_key("EDGE") :
14
            score += 1
14
            score += 10*10
15
        
15
        
16
        # 3G : 2, 0
16
        # 3G : 2, 0
17
        if features.has_key("3G") :
17
        if features.has_key("3G") :
18
            score += 2
18
            score += 10*25
19
        
19
        
20
        # WLAN : 2, 0
20
        # WLAN : 2, 0
21
        if features.has_key("WLAN") :
21
        if features.has_key("WLAN") :
22
            score += 2
22
            score += 10*25
23
        
23
        
24
        # Bluetooth : 1, 0
24
        # Bluetooth : 1, 0
25
        if features.has_key("Bluetooth") :
25
        if features.has_key("Bluetooth") :
26
            score += 1
26
            score += 10*10
27
         
27
         
28
        # USB : 1, 0
28
        # USB : 1, 0
29
        if features.has_key("USB") :
29
        if features.has_key("USB") :
30
            score += 1
30
            score += 10*10
31
 
31
        
-
 
32
        score = score / 100
32
    return score        
33
    return score