Subversion Repositories SmartDukaan

Rev

Rev 4244 | Rev 4706 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 naveen 1
def getscore(struct):
1915 rajveer 2
 
3
    score = 0.0
4334 mandeep.dh 4
    java_score = 6.0
5
    security_score = 4.0
1915 rajveer 6
    os_score = 0.0
7
 
8
    if struct.has_key("features") :
9
        features = struct.get("features")
10
 
11
        # GPS Type : Integrated GPS-4, Bluetooth GPS-2
12
        if features.has_key("Java") :
13
           java_score = 10
14
 
15
        if features.has_key("Security") :
16
            if features.get("Security") > 5 :
17
                security_score = 10
18
            else:
19
                security_score = 2*features.get("Security") 
20
 
21
        if features.has_key("OS") :
1936 rajveer 22
           os = features.get("OS")
23
           os = os[0]
24
           if os.find("Android") > -1 :
25
               if os.find("1.5") > -1 :
26
                   os_score = 4
27
               if os.find("1.6") > -1 :
28
                   os_score = 6
29
               if os.find("2.1") > -1 :
30
                   os_score = 7
31
               if os.find("2.2") > -1 :
32
                   os_score = 8
33
               if os.find("2.3") > -1 :
34
                   os_score = 9
2604 rajveer 35
               if os.find("3.0") > -1 :
36
                   os_score = 9.5
4193 mandeep.dh 37
               if os.find("3.1") > -1 :
38
                   os_score = 9.7
1936 rajveer 39
 
40
           if os.find("BlackBerry") > -1 :
41
               if os.find("5.0") > -1 :
42
                   os_score = 6
43
               if os.find("6.0") > -1 :
44
                   os_score = 8
2913 rajveer 45
               if os.find("7.0") > -1 :
46
                   os_score = 9
2604 rajveer 47
               if os.find("Tablet OS") > -1 :
48
                   os_score = 9.5
49
 
1936 rajveer 50
           if os.find("Brew Mobile Platform") > -1 :
51
               os_score = 5
52
 
53
           if os.find("Maemo 5") > -1 :
54
               os_score = 6
55
 
3927 rajveer 56
           if os.find("Samsung") > -1 :
57
               if os.find("bada") > -1 :
58
                   os_score = 5
59
               if os.find("bada 1.2") > -1 :
60
                   os_score = 6
61
               if os.find("bada 2.0") > -1 :
62
                   os_score = 7
1936 rajveer 63
 
64
           if os.find("Microsoft Windows Mobile 6.5.3 Professional") > -1 :
65
               os_score = 6
66
 
4244 mandeep.dh 67
           if os.find("Windows Phone 7") > -1 :
68
               os_score = 7.5
69
 
70
           if os.find("Windows Phone 7.5 Mango") > -1 :
4243 mandeep.dh 71
               os_score = 8.5
72
 
1936 rajveer 73
           if os.find("Symbian") > -1 :
74
               if os.find("40") > -1 :
75
                   os_score = 5
76
               if os.find("60") > -1 :
77
                   os_score = 7
78
               if os.find("^3") > -1 :
79
                   os_score = 8
2546 rajveer 80
               if os.find("Symbian Anna") > -1:
81
                   os_score = 8.5
3479 rajveer 82
               if os.find("Symbian Belle") > -1:
83
                   os_score = 9
1979 rajveer 84
 
85
           if os.find("iOS") > -1 :
86
               if os.find("4") > -1 :
87
                   os_score = 9
4193 mandeep.dh 88
               if os.find("5") > -1 :
89
                   os_score = 10
3927 rajveer 90
 
1936 rajveer 91
           if os_score == 0:
92
               os_score = 3
93
 
1915 rajveer 94
        score = (20*java_score + 20*security_score + 60*os_score)/100
95
    return score