Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 naveen 1
def getscore(struct):
78 naveen 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
 
52
    return score