Subversion Repositories SmartDukaan

Rev

Rev 2556 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2556 Rev 2655
Line 2... Line 2...
2
    
2
    
3
    score = 0.0
3
    score = 0.0
4
    type_score = 0.0
4
    type_score = 0.0
5
    navigation_score = 0.0
5
    navigation_score = 0.0
6
    touch_screen_score = 0.0
6
    touch_screen_score = 0.0
-
 
7
 
-
 
8
    category = struct.has_key("category")
7
    
9
        
8
    if struct.has_key("features") :
10
    if struct.has_key("features") :
9
        features = struct.get("features")
11
        features = struct.get("features")
10
        if features.has_key("Type") :
12
        if features.has_key("Type") :
11
            type = features.get("Type")
13
            type = features.get("Type")
12
            if len(type) > 0 :
14
            if len(type) > 0 :
Line 58... Line 60...
58
                    touch_screen_score = 6
60
                    touch_screen_score = 6
59
    
61
    
60
    print "type_score" + str(type_score)
62
    print "type_score" + str(type_score)
61
    print "navigation_score" + str(navigation_score)
63
    print "navigation_score" + str(navigation_score)
62
    print "touch_screen_score" + str(touch_screen_score)
64
    print "touch_screen_score" + str(touch_screen_score)
63
                     
-
 
64
    if touch_screen_score == 0 :
-
 
65
        score = (55*type_score + 45*navigation_score)/100    
-
 
66
    else :
-
 
67
        score = (40*type_score + 30*navigation_score + 30*touch_screen_score)/100
-
 
68
    
65
    
-
 
66
    if category == "Tablets" :
-
 
67
        if touch_screen_score == 0 :
-
 
68
            score = (100*type_score)/100
-
 
69
        else :
-
 
70
            score = (60*type_score + 40*touch_screen_score)/100
-
 
71
    else :
-
 
72
        if touch_screen_score == 0 :
-
 
73
            score = (55*type_score + 45*navigation_score)/100    
-
 
74
        else :
-
 
75
            score = (40*type_score + 30*navigation_score + 30*touch_screen_score)/100
69
    
76
    
70
    
77
    
71
    return score
78
    return score