Subversion Repositories SmartDukaan

Rev

Rev 71 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 78
Line 1... Line 1...
1
def getscore(struct):
1
def getscore(struct):
-
 
2
    
-
 
3
    score = 0
-
 
4
    
-
 
5
    if struct.has_key("features") :
-
 
6
        features = struct.get("features")
-
 
7
 
-
 
8
        # Weight : <=100-3, <=150-2, >150-1
-
 
9
        if features.has_key("Weight") :
-
 
10
            weight = features.get("Weight")
-
 
11
            
-
 
12
            if len(weight) > 0 :
-
 
13
                weight = int(weight[0])
-
 
14
                print "weight=" + `weight`
-
 
15
                
-
 
16
                if weight <= 100 :
-
 
17
                    score += 3
-
 
18
                
-
 
19
                elif weight <= 150 :
-
 
20
                    score += 2
-
 
21
 
-
 
22
                elif weight > 150 :
-
 
23
                    score += 1
-
 
24
    
-
 
25
        # REVISIT
-
 
26
        # Size : Thickness <=10-4, <=12-3, <=14-2, >14-1
-
 
27
        if features.has_key("Size") :
-
 
28
            size = features.get("Size")
-
 
29
            
-
 
30
            if len(size) > 2 :
-
 
31
                thickness = float(size[2])
-
 
32
                print "thickness=" + `thickness`
-
 
33
                
-
 
34
                if thickness <= 10 :
-
 
35
                    score += 4
-
 
36
                
-
 
37
                elif thickness <= 12 :
-
 
38
                    score += 3
-
 
39
 
-
 
40
                elif thickness <= 14 :
-
 
41
                    score += 2
-
 
42
                    
-
 
43
                elif thickness > 14 :
-
 
44
                    score += 1
-
 
45
    
-
 
46
    # REVISIT
-
 
47
    # Form Factor
-
 
48
    
-
 
49
    # REVISIT
-
 
50
    # Color
-
 
51
    
2
    return 7
52
    return score