Subversion Repositories SmartDukaan

Rev

Rev 3448 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3448 Rev 8045
Line -... Line 1...
-
 
1
import math
1
def getscore(struct) :
2
def getscore(struct) :
2
    
3
    
3
    score = 0.0
4
    score = 0.0
4
    voip_score = 0.0
5
    communication_facilities_score = 0.0
5
    twog_network_score = 0.0
6
    twog_network_score = 0.0
6
    threeg_network_score = 0.0
7
    threeg_network_score = 0.0
7
    multiple_sim_score = 0.0
8
    multiple_sim_score = 0.0
8
    
9
    
9
    if struct.has_key("features") :
10
    if struct.has_key("features") :
10
        features = struct.get("features")
11
        features = struct.get("features")
11
        if features.has_key("VoIP") :
12
        if features.has_key("Communication facilities") :
-
 
13
            communication_facilities = features.get("Communication facilities")
12
            voip_score = 10
14
            communication_facilities_score = min(3,len(communication_facilities))*3.3
13
        
15
        
14
        if features.has_key("2G network") :
16
        if features.has_key("2G network") :
15
            twog_network = features.get("2G network")
17
            twog_network = features.get("2G network")
16
            if len(twog_network) > 0 :
18
            if len(twog_network) > 0 :
17
                twog_network = twog_network[0]
19
                twog_network = twog_network[0]
Line 27... Line 29...
27
            threeg_network_score = 10
29
            threeg_network_score = 10
28
                
30
                
29
        if features.has_key("Multiple SIM") :
31
        if features.has_key("Multiple SIM") :
30
            multiple_sim_score = 10
32
            multiple_sim_score = 10
31
    
33
    
32
    score = (20*voip_score + 40*twog_network_score + 30*threeg_network_score + 10*multiple_sim_score)/100.0    
34
    score = (15*communication_facilities_score + 40*twog_network_score + 30*threeg_network_score + round(15*multiple_sim_score))/100.0    
33
    
35
    
34
    print "voip_score" + str(voip_score)
-
 
35
    print "twog_network_score" + str(twog_network_score)
36
    print "twog_network_score" + str(twog_network_score)
36
    print "threeg_network_score" + str(threeg_network_score)
37
    print "threeg_network_score" + str(threeg_network_score)
37
    print "multiple_sim_score" + str(multiple_sim_score)
38
    print "multiple_sim_score" + str(multiple_sim_score)
38
    
39
    
39
    return score
40
    return score
40
41