Subversion Repositories SmartDukaan

Rev

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

def getscore(struct):

    score = 0.0
    java_score = 0.0
    security_score = 0.0
    os_score = 0.0
    
    if struct.has_key("features") :
        features = struct.get("features")
        
        # GPS Type : Integrated GPS-4, Bluetooth GPS-2
        if features.has_key("Java") :
           java_score = 10

        if features.has_key("Security") :
            if features.get("Security") > 5 :
                security_score = 10
            else:
                security_score = 2*features.get("Security") 

        if features.has_key("OS") :
           os = features.get("OS")
           os = os[0]
           if os.find("Android") > -1 :
               if os.find("1.5") > -1 :
                   os_score = 4
               if os.find("1.6") > -1 :
                   os_score = 6
               if os.find("2.1") > -1 :
                   os_score = 7
               if os.find("2.2") > -1 :
                   os_score = 8
               if os.find("2.3") > -1 :
                   os_score = 9
               if os.find("3.0") > -1 :
                   os_score = 9.5
            
           if os.find("BlackBerry") > -1 :
               if os.find("5.0") > -1 :
                   os_score = 6
               if os.find("6.0") > -1 :
                   os_score = 8
               if os.find("7.0") > -1 :
                   os_score = 9
               if os.find("Tablet OS") > -1 :
                   os_score = 9.5
                   
           if os.find("Brew Mobile Platform") > -1 :
               os_score = 5
           
           if os.find("Maemo 5") > -1 :
               os_score = 6

           if os.find("Bada") > -1 :
               os_score = 6

           if os.find("Microsoft Windows Mobile 6.5.3 Professional") > -1 :
               os_score = 6

           if os.find("Windows Phone OS 7") > -1 :
               os_score = 9.5
               
           if os.find("Symbian") > -1 :
               if os.find("40") > -1 :
                   os_score = 5
               if os.find("60") > -1 :
                   os_score = 7
               if os.find("^3") > -1 :
                   os_score = 8
               if os.find("Symbian Anna") > -1:
                   os_score = 8.5
            
           if os.find("iOS") > -1 :
               if os.find("4") > -1 :
                   os_score = 9
              
           if os_score == 0:
               os_score = 3

            
               
        
        score = (20*java_score + 20*security_score + 60*os_score)/100
    return score