Subversion Repositories SmartDukaan

Rev

Rev 75 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75 Rev 76
Line 22... Line 22...
22
                features = capacity.get("features")
22
                features = capacity.get("features")
23
                    
23
                    
24
                # Capacity > Music Playback : <20 - 0.5, <35 - 1, >35 - 1.5
24
                # Capacity > Music Playback : <20 - 0.5, <35 - 1, >35 - 1.5
25
                if features.has_key("Music Playback") :
25
                if features.has_key("Music Playback") :
26
                    musicplayback = features.get("Music Playback")
26
                    musicplayback = features.get("Music Playback")
27
                    musicplayback = int(musicplayback[0])
-
 
28
                    print "musicplayback=" + `musicplayback`
-
 
29
                    
27
                    
-
 
28
                    if len(musicplayback) > 0 :
-
 
29
                        musicplayback = int(musicplayback[0])
-
 
30
                        print "musicplayback=" + `musicplayback`
-
 
31
                        
30
                    if musicplayback < 20 :
32
                        if musicplayback < 20 :
31
                        score = score + 0.5
33
                            score = score + 0.5
32
                            
34
                                
33
                    elif musicplayback < 35 :
35
                        elif musicplayback < 35 :
34
                          score = score + 1.0
36
                              score = score + 1.0
35
 
37
    
36
                    elif musicplayback > 35 :
38
                        elif musicplayback > 35 :
37
                          score = score + 1.5
39
                              score = score + 1.5
38
  
40
  
39
                # Capacity > Video Playback : <2 - 0.5, <5 - 1, >5 - 1.5 
41
                # Capacity > Video Playback : <2 - 0.5, <5 - 1, >5 - 1.5 
40
                if features.has_key("Video Playback") :
42
                if features.has_key("Video Playback") :
41
                    videoplayback = features.get("Video Playback")
43
                    videoplayback = features.get("Video Playback")
-
 
44
                    
-
 
45
                    if len(videoplayback) > 0 :
42
                    videoplayback = int(videoplayback[0])
46
                        videoplayback = int(videoplayback[0])
43
                    print "videoplayback=" + `videoplayback`
47
                        print "videoplayback=" + `videoplayback`
44
                     
48
                         
45
                    if videoplayback < 2 :
49
                        if videoplayback < 2 :
46
                        score = score + 0.5
50
                            score = score + 0.5
47
                            
51
                                
48
                    elif videoplayback < 5 :
52
                        elif videoplayback < 5 :
49
                          score = score + 1.0
53
                              score = score + 1.0
50
 
54
    
51
                    elif videoplayback > 5 :
55
                        elif videoplayback > 5 :
52
                          score = score + 1.5
56
                              score = score + 1.5
53
 
57
 
54
                # Capacity > TV Playback : <2 - 0.5, <5 - 1, >5 - 1.5
58
                # Capacity > TV Playback : <2 - 0.5, <5 - 1, >5 - 1.5
55
                if features.has_key("TV Playback") :
59
                if features.has_key("TV Playback") :
56
                    tvplayback = features.get("TV Playback")
60
                    tvplayback = features.get("TV Playback")
57
                    tvplayback = int(tvplayback[0])
61
                    tvplayback = int(tvplayback[0])
58
                    print "tvplayback=" + `tvplayback`
62
                    
59
 
-
 
60
                    if tvplayback < 2 :
63
                    if len(tvplayback) > 0 :
61
                        score = score + 0.5
64
                        print "tvplayback=" + `tvplayback`
-
 
65
    
62
                            
66
                        if tvplayback < 2 :
63
                    elif tvplayback < 5 :
67
                            score = score + 0.5
64
                          score = score + 1.0
68
                                
65
 
-
 
66
                    elif tvplayback > 5 :
69
                        elif tvplayback < 5 :
67
                          score = score + 1.5
70
                              score = score + 1.0
68
    
71
    
-
 
72
                        elif tvplayback > 5 :
-
 
73
                              score = score + 1.5
-
 
74
        
69
            if capacity.has_key("childrenslides") :
75
            if capacity.has_key("childrenslides") :
70
                childrenslides = capacity.get("childrenslides")
76
                childrenslides = capacity.get("childrenslides")
71
                
77
                
72
                if childrenslides.has_key("Talk time") :
78
                if childrenslides.has_key("Talk time") :
73
                    talktime = childrenslides.get("Talk time")
79
                    talktime = childrenslides.get("Talk time")
Line 76... Line 82...
76
                        features = talktime.get("features")
82
                        features = talktime.get("features")
77
                        
83
                        
78
                        # Capacity > Talk time > 2G : <5 - 0.5, <10 - 1, >10 - 1.5
84
                        # Capacity > Talk time > 2G : <5 - 0.5, <10 - 1, >10 - 1.5
79
                        if features.has_key("2G") :
85
                        if features.has_key("2G") :
80
                            twog = features.get("2G")
86
                            twog = features.get("2G")
-
 
87
                            if len(twog) > 0 :
81
                            twog = twog[0]
88
                                twog = twog[0]
82
                            twog = twog.split(" ")
89
                                twog = twog.split(" ")
83
                            twog = int(twog[0])
90
                                twog = int(twog[0])
84
                            print "twog=" + `twog`
91
                                print "twog=" + `twog`
85
                            
92
                                
86
                            if twog < 5 :
93
                                if twog < 5 :
87
                                score = score + 0.5
94
                                    score = score + 0.5
88
                            
95
                                
89
                            elif twog < 10 :
96
                                elif twog < 10 :
90
                                score = score + 1.0
97
                                    score = score + 1.0
91
 
98
    
92
                            elif twog > 10 :
99
                                elif twog > 10 :
93
                                score = score + 1.5
100
                                    score = score + 1.5
94
                                
101
                                
95
                        # Capacity > Talk time > 3G : <5 - 0.5, <10 - 1, >10 - 1.5
102
                        # Capacity > Talk time > 3G : <5 - 0.5, <10 - 1, >10 - 1.5
96
                        if features.has_key("3G") :
103
                        if features.has_key("3G") :
97
                            threeg = features.get("3G")
104
                            threeg = features.get("3G")
98
                            threeg = threeg[0]
-
 
99
                            threeg = threeg.split(" ")
-
 
100
                            threeg = int(threeg[0])
-
 
101
                            print "threeg=" + `threeg`
-
 
102
 
-
 
103
                            if threeg < 5 :
-
 
104
                                score = score + 0.5
-
 
105
                            
105
                            
-
 
106
                            if len(threeg) > 0 :
-
 
107
                                threeg = threeg[0]
-
 
108
                                threeg = threeg.split(" ")
-
 
109
                                threeg = int(threeg[0])
-
 
110
                                print "threeg=" + `threeg`
-
 
111
    
-
 
112
                                if threeg < 5 :
-
 
113
                                    score = score + 0.5
-
 
114
                                
106
                            elif threeg < 10 :
115
                                elif threeg < 10 :
107
                                score = score + 1.0
116
                                    score = score + 1.0
108
 
117
    
109
                            elif threeg > 10 :
118
                                elif threeg > 10 :
110
                                score = score + 1.5
119
                                    score = score + 1.5
111
                    
120
                        
112
                if childrenslides.has_key("Standby time") :
121
                if childrenslides.has_key("Standby time") :
113
                    standbytime = childrenslides.get("Standby time")
122
                    standbytime = childrenslides.get("Standby time")
114
                    
123
                    
115
                    if standbytime.has_key("features") :
124
                    if standbytime.has_key("features") :
116
                        features = standbytime.get("features")
125
                        features = standbytime.get("features")
117
                        
126
                        
118
                        # Capacity > Standby time > 2G : <10 - 0.5, <20 - 1, >20 - 1.5
127
                        # Capacity > Standby time > 2G : <10 - 0.5, <20 - 1, >20 - 1.5
119
                        if features.has_key("2G") :
128
                        if features.has_key("2G") :
120
                            twog = features.get("2G")
129
                            twog = features.get("2G")
121
                            twog = twog[0]
-
 
122
                            twog = twog.split(" ")
-
 
123
                            twog = int(twog[0])
-
 
124
                            print "twog=" + `twog`
-
 
125
 
-
 
126
                            if twog < 10 :
-
 
127
                                score = score + 0.5
-
 
128
                            
130
                            
129
                            elif twog < 20 :
131
                            if len(twog) > 0 :
130
                                score = score + 1.0
132
                                twog = twog[0]
-
 
133
                                twog = twog.split(" ")
-
 
134
                                twog = int(twog[0])
-
 
135
                                print "twog=" + `twog`
131
 
136
    
132
                            elif twog > 20 :
137
                                if twog < 10 :
133
                                score = score + 1.5
138
                                    score = score + 0.5
134
                                
139
                                
-
 
140
                                elif twog < 20 :
-
 
141
                                    score = score + 1.0
-
 
142
    
-
 
143
                                elif twog > 20 :
-
 
144
                                    score = score + 1.5
-
 
145
                                    
135
                        # Capacity > Standby time > 3G : <10 - 0.5, <20 - 1, >20 - 1.5
146
                        # Capacity > Standby time > 3G : <10 - 0.5, <20 - 1, >20 - 1.5
136
                        if features.has_key("3G") :
147
                        if features.has_key("3G") :
137
                            threeg = features.get("3G")
148
                            threeg = features.get("3G")
138
                            threeg = threeg[0]
-
 
139
                            threeg = threeg.split(" ")
-
 
140
                            threeg = int(threeg[0])
-
 
141
                            print "threeg=" + `threeg`
-
 
142
 
-
 
143
                            if threeg < 10 :
-
 
144
                                score = score + 0.5
-
 
145
                            
149
                            
146
                            elif threeg < 20 :
-
 
147
                                score = score + 1.5
-
 
148
 
-
 
149
                            elif threeg > 20 :
-
 
150
                                score = score + 1.5
-
 
151
                    
-
 
152
    return int(math.ceil(score))
-
 
153
150
                            if len(threeg) > 0 :
-
 
151
                                threeg = threeg[0]
-
 
152
                                threeg = threeg.split(" ")
-
 
153
                                threeg = int(threeg[0])
-
 
154
                                print "threeg=" + `threeg`
-
 
155
    
-
 
156
                                if threeg < 10 :
-
 
157
                                    score = score + 0.5
-
 
158
                                
-
 
159
                                elif threeg < 20 :
-
 
160
                                    score = score + 1.5
-
 
161
    
-
 
162
                                elif threeg > 20 :
-
 
163
                                    score = score + 1.5
-
 
164
                        
-
 
165
    return int(math.floor(score))
-
 
166
154
167