Subversion Repositories SmartDukaan

Rev

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

def getscore(struct):
    
    score = 0
    
    if struct.has_key("features") :
        features = struct.get("features")

        # Weight : <=100-3, <=150-2, >150-1
        if features.has_key("Weight") :
            weight = features.get("Weight")
            
            if len(weight) > 0 :
                weight = float(weight[0])
                print "weight=" + `weight`
                
                if weight <= 100 :
                    score += 3
                
                elif weight <= 150 :
                    score += 2

                elif weight > 150 :
                    score += 1
    
        # REVISIT
        # Size : Thickness <=10-4, <=12-3, <=14-2, >14-1
        if features.has_key("Size") :
            size = features.get("Size")
            
            if len(size) > 2 :
                thickness = float(size[2])
                print "thickness=" + `thickness`
                
                if thickness <= 10 :
                    score += 4
                
                elif thickness <= 12 :
                    score += 3

                elif thickness <= 14 :
                    score += 2
                    
                elif thickness > 14 :
                    score += 1
    
    # REVISIT
    # Form Factor
    
    # REVISIT
    # Color
    
    return score