Subversion Repositories SmartDukaan

Rev

Rev 8547 | 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]
4706 amit.gupta 24
           if os.find("Proprietary") > -1 :
25
               os_score = 4
26
           elif os.find("Android") > -1 :
1936 rajveer 27
               if os.find("1.5") > -1 :
8087 amit.gupta 28
                   os_score = 5
1936 rajveer 29
               if os.find("1.6") > -1 :
8087 amit.gupta 30
                   os_score = 5.5
1936 rajveer 31
               if os.find("2.1") > -1 :
8087 amit.gupta 32
                   os_score = 6
1936 rajveer 33
               if os.find("2.2") > -1 :
8087 amit.gupta 34
                   os_score = 6.5
4706 amit.gupta 35
               if os.find("2.3") > -1 :
8087 amit.gupta 36
                   os_score = 7
37
               if os.find("3.0") > -1 :
1936 rajveer 38
                   os_score = 8
4193 mandeep.dh 39
               if os.find("3.1") > -1 :
8087 amit.gupta 40
                   os_score = 8
4706 amit.gupta 41
               if os.find("3.2") > -1 :
8087 amit.gupta 42
                   os_score = 8
4818 amit.gupta 43
               if os.find("4.0") > -1 :
8087 amit.gupta 44
                   os_score = 8.5
6020 amit.gupta 45
               if os.find("4.1") > -1 :
8087 amit.gupta 46
                   os_score = 9.0
47
               if os.find("4.2") > -1 :
48
                   os_score = 9.0
8083 amit.gupta 49
               if os.find("4.3") > -1 :
8598 amit.gupta 50
                   os_score = 9.5
51
               if os.find("4.4") > -1 :
6320 amit.gupta 52
                   os_score = 10
1936 rajveer 53
 
4706 amit.gupta 54
           elif os.find("BlackBerry") > -1 :
55
               if os.find("OS") > -1 :
8087 amit.gupta 56
                   os_score = 6
57
               if os.find("5.0") > -1 :
4706 amit.gupta 58
                   os_score = 6.5
1936 rajveer 59
               if os.find("6.0") > -1 :
8087 amit.gupta 60
                   os_score = 7.5
2913 rajveer 61
               if os.find("7.0") > -1 :
8087 amit.gupta 62
                   os_score = 8.0
63
               if os.find("7.1") > -1 :
4706 amit.gupta 64
                   os_score = 8.5
2604 rajveer 65
               if os.find("Tablet OS") > -1 :
4706 amit.gupta 66
                   os_score = 8
6774 amit.gupta 67
               if os.find("10") > -1 :
8087 amit.gupta 68
                   os_score = 9
8154 amit.gupta 69
               if os.find("BlackBerry OS 10.2") > -1 :
70
                   os_score = 9.2
2604 rajveer 71
 
4706 amit.gupta 72
           else :
73
               if os.find("Brew Mobile Platform") > -1 :
74
                   os_score = 6
1936 rajveer 75
 
76
 
4706 amit.gupta 77
               if os.find("Samsung") > -1 :
78
                   if os.find("bada") > -1 :
79
                       os_score = 5
80
                   if os.find("bada 1.2") > -1 :
81
                       os_score = 5
82
 
83
               if os.find("Windows Phone 7") > -1 :
84
                   os_score = 7.5
85
 
6068 amit.gupta 86
 
4706 amit.gupta 87
               if os.find("Windows Phone 7.5 Mango") > -1 :
88
                   os_score = 8.5
4929 amit.gupta 89
 
6068 amit.gupta 90
               if os.find("Windows Phone 8") > -1 :
91
                   os_score = 9.5
92
 
8547 amit.gupta 93
               if os.find("Windows RT 8.1") > -1 :
94
                   os_score = 10
95
 
4929 amit.gupta 96
               if os.find("Windows Mobile 6.5") > -1 :
97
                   os_score = 5
4706 amit.gupta 98
 
99
               if os.find("Maemo 5") > -1 :
3927 rajveer 100
                   os_score = 7
4706 amit.gupta 101
 
102
               if os.find("Symbian") > -1 :
103
                   if os.find("40") > -1 :
104
                       os_score = 4
105
                   if os.find("60") > -1 :
106
                       os_score = 6
107
                   if os.find("^3") > -1 :
108
                       os_score = 7.5
109
                   if os.find("Symbian Anna") > -1:
110
                       os_score = 8
111
                   if os.find("Symbian Belle") > -1:
112
                       os_score = 8.5
113
 
114
               if os.find("iOS") > -1 :
115
                   if os.find("4") > -1 :
8087 amit.gupta 116
                       os_score = 8
4706 amit.gupta 117
                   if os.find("5") > -1 :
8087 amit.gupta 118
                       os_score = 8.5
6273 amar.kumar 119
                   if os.find("6") > -1 :
8087 amit.gupta 120
                       os_score = 9
8155 amit.gupta 121
                   if os.find("7") > -1 :
122
                       os_score = 10
4706 amit.gupta 123
 
1936 rajveer 124
           if os_score == 0:
125
               os_score = 3
4706 amit.gupta 126
           print "Scores" + str(os_score)
8087 amit.gupta 127
        score = (10*java_score + 10*security_score + 80*os_score)/100
8155 amit.gupta 128
    return score