Subversion Repositories SmartDukaan

Rev

Rev 4334 | Rev 4818 | 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]
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 :
4706 amit.gupta 28
                   os_score = 6
1936 rajveer 29
               if os.find("1.6") > -1 :
4706 amit.gupta 30
                   os_score = 6.5
1936 rajveer 31
               if os.find("2.1") > -1 :
32
                   os_score = 7
33
               if os.find("2.2") > -1 :
4706 amit.gupta 34
                   os_score = 7.5
35
               if os.find("2.3") > -1 :
1936 rajveer 36
                   os_score = 8
4706 amit.gupta 37
               if os.find("3.0") > -1 :
1936 rajveer 38
                   os_score = 9
4193 mandeep.dh 39
               if os.find("3.1") > -1 :
4706 amit.gupta 40
                   os_score = 9
41
               if os.find("3.2") > -1 :
42
                   os_score = 9
1936 rajveer 43
 
4706 amit.gupta 44
           elif os.find("BlackBerry") > -1 :
45
               if os.find("OS") > -1 :
46
                   os_score = 6.5
1936 rajveer 47
               if os.find("5.0") > -1 :
4706 amit.gupta 48
                   os_score = 7
1936 rajveer 49
               if os.find("6.0") > -1 :
50
                   os_score = 8
2913 rajveer 51
               if os.find("7.0") > -1 :
4706 amit.gupta 52
                   os_score = 8.5
2604 rajveer 53
               if os.find("Tablet OS") > -1 :
4706 amit.gupta 54
                   os_score = 8
2604 rajveer 55
 
4706 amit.gupta 56
           else :
57
               if os.find("Brew Mobile Platform") > -1 :
58
                   os_score = 6
1936 rajveer 59
 
60
 
4706 amit.gupta 61
               if os.find("Samsung") > -1 :
62
                   if os.find("bada") > -1 :
63
                       os_score = 5
64
                   if os.find("bada 1.2") > -1 :
65
                       os_score = 5
66
 
67
               if os.find("Windows Phone 7") > -1 :
68
                   os_score = 7.5
69
 
70
               if os.find("Windows Phone 7.5 Mango") > -1 :
71
                   os_score = 8.5
72
 
73
               if os.find("Maemo 5") > -1 :
3927 rajveer 74
                   os_score = 7
4706 amit.gupta 75
 
76
               if os.find("Symbian") > -1 :
77
                   if os.find("40") > -1 :
78
                       os_score = 4
79
                   if os.find("60") > -1 :
80
                       os_score = 6
81
                   if os.find("^3") > -1 :
82
                       os_score = 7.5
83
                   if os.find("Symbian Anna") > -1:
84
                       os_score = 8
85
                   if os.find("Symbian Belle") > -1:
86
                       os_score = 8.5
87
 
88
               if os.find("iOS") > -1 :
89
                   if os.find("4") > -1 :
90
                       os_score = 9
91
                   if os.find("5") > -1 :
92
                       os_score = 9.5
93
 
1936 rajveer 94
           if os_score == 0:
95
               os_score = 3
4706 amit.gupta 96
           print "Scores" + str(os_score)
1915 rajveer 97
        score = (20*java_score + 20*security_score + 60*os_score)/100
98
    return score