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
    
    category = struct.get("category")
    
    if struct.has_key("features") :
        features = struct.get("features")
        
        if category == "Tablets" :

            # GPRS : 1, 0
            if features.has_key("GPRS") :
                score += 10*10
    
            # EDGE : 1, 0
            if features.has_key("EDGE") :
                score += 10*10
            
            # 3G : 2, 0
            if features.has_key("3G") :
                score += 10*10
            
            # WLAN : 2, 0
            if features.has_key("Wi-Fi") :
                score += 10*10
            
            # Bluetooth : 1, 0
            if features.has_key("Bluetooth") :
                score += 10*10
             
            # USB : 1, 0
            if features.has_key("USB") :
                score += 10*10
            
            # USB Port: 1, 0
            if features.has_key("USB port") :
                score += 10*10
    
            # USB Port: 1, 0
            if features.has_key("Docking port") :
                score += 10*10
                
            # HDMI Port: 1, 0
            if features.has_key("HDMI port") :
                score += 10*10
            
            # Card slot: 1, 0
            if features.has_key("Card slot") :
                score += 10*10
                                

        else:
            # GPRS : 1, 0
            if features.has_key("GPRS") :
                score += 10*20
    
            # EDGE : 1, 0
            if features.has_key("EDGE") :
                score += 10*10
            
            # 3G : 2, 0
            if features.has_key("3G") :
                score += 10*25
            
            # WLAN : 2, 0
            if features.has_key("Wi-Fi") :
                score += 10*25
            
            # Bluetooth : 1, 0
            if features.has_key("Bluetooth") :
                score += 10*10
             
            # USB : 1, 0
            if features.has_key("USB") :
                score += 10*10

        score = score / 100
    return score