Subversion Repositories SmartDukaan

Rev

Rev 4129 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
77 naveen 1
def getscore(struct) :
2
 
1915 rajveer 3
    score = 0.0
2655 rajveer 4
 
5
    category = struct.get("category")
6
 
77 naveen 7
    if struct.has_key("features") :
8
        features = struct.get("features")
2655 rajveer 9
 
10
        if category == "Tablets" :
11
 
12
            # GPRS : 1, 0
13
            if features.has_key("GPRS") :
14
                score += 10*10
77 naveen 15
 
2655 rajveer 16
            # EDGE : 1, 0
17
            if features.has_key("EDGE") :
18
                score += 10*10
19
 
20
            # 3G : 2, 0
21
            if features.has_key("3G") :
22
                score += 10*10
23
 
24
            # WLAN : 2, 0
25
            if features.has_key("Wi-Fi") :
26
                score += 10*10
27
 
28
            # Bluetooth : 1, 0
29
            if features.has_key("Bluetooth") :
30
                score += 10*10
31
 
32
            # USB : 1, 0
33
            if features.has_key("USB") :
34
                score += 10*10
35
 
36
            # USB Port: 1, 0
37
            if features.has_key("USB port") :
38
                score += 10*10
39
 
40
            # USB Port: 1, 0
41
            if features.has_key("Docking port") :
42
                score += 10*10
43
 
44
            # HDMI Port: 1, 0
45
            if features.has_key("HDMI port") :
46
                score += 10*10
47
 
48
            # Card slot: 1, 0
49
            if features.has_key("Card slot") :
50
                score += 10*10
51
 
77 naveen 52
 
2655 rajveer 53
        else:
54
            # GPRS : 1, 0
55
            if features.has_key("GPRS") :
4129 mandeep.dh 56
                score += 10*15
2655 rajveer 57
 
58
            # EDGE : 1, 0
7973 amit.gupta 59
            #if features.has_key("EDGE") :
60
            #    score += 10*10
2655 rajveer 61
 
62
            # 3G : 2, 0
63
            if features.has_key("3G") :
64
                score += 10*25
65
 
66
            # WLAN : 2, 0
67
            if features.has_key("Wi-Fi") :
7973 amit.gupta 68
                score += 10*20
2655 rajveer 69
 
70
            # Bluetooth : 1, 0
71
            if features.has_key("Bluetooth") :
72
                score += 10*10
73
 
74
            # USB : 1, 0
75
            if features.has_key("USB") :
76
                score += 10*10
77
 
4129 mandeep.dh 78
            # NFC
79
            if features.has_key("NFC") :
80
                score += 10*5
7973 amit.gupta 81
 
82
            # GPS
83
            if features.has_key("GPS type") :
84
                gps_type = features.get("GPS type")
85
                if "Integrated GPS" in gps_type :
86
                    score += 5*15
87
 
88
                if "A-GPS" in gps_type :
89
                    score += 5*15
4129 mandeep.dh 90
 
1915 rajveer 91
        score = score / 100
4129 mandeep.dh 92
    return score