Subversion Repositories SmartDukaan

Rev

Rev 1915 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

def getscore(struct) :
    
    score = 0.0
    voip_score = 0.0
    twog_network_score = 0.0
    threeg_network_score = 0.0
    multiple_sim_score = 0.0
    
    if struct.has_key("features") :
        features = struct.get("features")
        if features.has_key("VoIP") :
            voip_score = 10
        
        if features.has_key("2G network") :
            twog_network = features.get("2G network")
            if len(twog_network) > 0 :
                twog_network = twog_network[0]
                print "2G Network=" + `twog_network`
                if twog_network.find("Quadband") > -1 :
                    twog_network_score = 9
                elif twog_network.find("Triband") > -1 :
                    twog_network_score = 7
                elif twog_network.find("Dualband") > -1 :
                    twog_network_score = 5
        
        if features.has_key("3G network") :
            threeg_network_score = 10
                
        if features.has_key("Multiple SIM") :
            multiple_sim_score = 10
    
    score = (20*voip_score + 40*twog_network_score + 30*threeg_network_score + 10*multiple_sim_score)/100.0    
    
    print "voip_score" + str(voip_score)
    print "twog_network_score" + str(twog_network_score)
    print "threeg_network_score" + str(threeg_network_score)
    print "multiple_sim_score" + str(multiple_sim_score)
    
    return score