Subversion Repositories SmartDukaan

Rev

Rev 323 | Rev 3448 | 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
    voip_score = 0.0
-
 
5
    twog_network_score = 0.0
-
 
6
    threeg_network_score = 0.0
-
 
7
    multiple_sim_score = 0.0
4
    
8
    
5
    if struct.has_key("features") :
9
    if struct.has_key("features") :
6
        features = struct.get("features")
10
        features = struct.get("features")
7
        if features.has_key("VoIP") :
11
        if features.has_key("VoIP") :
8
            # VoIP
-
 
9
            score = score + 2
12
            voip_score = 10
10
        
13
        
11
    if struct.has_key("childrenslides") :
14
        if features.has_key("2G network") :
12
        childrenslides = struct.get("childrenslides")
15
            twog_network = features.get("2G network")
-
 
16
            if len(twog_network) > 0 :
-
 
17
                twog_network = twog_network[0]
-
 
18
                print "2G Network=" + `twog_network`
-
 
19
                if twog_network.find("Quadband") > -1 :
-
 
20
                    twog_network_score = 9
-
 
21
                elif twog_network.find("Triband") > -1 :
-
 
22
                    twog_network_score = 7
-
 
23
                elif twog_network.find("Dualband") > -1 :
-
 
24
                    twog_network_score = 5
13
        
25
        
14
        if childrenslides.has_key("Cellular Technologies") :
-
 
15
            cts = childrenslides.get("Cellular Technologies")
-
 
16
            
-
 
17
            if cts.has_key("features") :
26
        if features.has_key("3G network") :
18
                features = cts.get("features")
27
            threeg_network_score = 10
19
                
28
                
20
                # REVISIT - We should compare frequencies supported
-
 
21
                # Cellular Technologies > 2G Network
-
 
22
                if features.has_key("2G Network") :
29
        if features.has_key("Multiple SIM") :
23
                    score = score + 2
30
            multiple_sim_score = 10
-
 
31
    
-
 
32
    score = (20*voip_score + 40*twog_network_score + 30*threeg_network_score + 10*multiple_sim_score)/100    
24
            
33
    
25
                # REVISIT - We should compare frequencies supported
34
    print "voip_score" + str(voip_score)
26
                # Cellular Technologies > 3G Network 
35
    print "twog_network_score" + str(twog_network_score)
27
                if features.has_key("3G Network") :
36
    print "threeg_network_score" + str(threeg_network_score)
28
                    score = score + 4
37
    print "multiple_sim_score" + str(multiple_sim_score)
29
    
38
    
30
    return score
39
    return score