| 4036 |
varun.gupt |
1 |
import utils
|
|
|
2 |
|
|
|
3 |
def getscore(struct):
|
|
|
4 |
|
|
|
5 |
score = 0.0
|
|
|
6 |
wireless_score = 0.0
|
|
|
7 |
ethernet_score = 0.0
|
|
|
8 |
bluetooth_score = 0.0
|
|
|
9 |
|
|
|
10 |
if struct.has_key('features'):
|
|
|
11 |
features = struct.get('features')
|
|
|
12 |
|
|
|
13 |
if features.has_key("Wireless LAN"):
|
|
|
14 |
wireless = str(features.get('Wireless LAN')[0])
|
|
|
15 |
wireless_score = 10.0 if wireless.find('b/g/n') > -1 else 8.0
|
|
|
16 |
|
|
|
17 |
if features.has_key('Ethernet LAN'):
|
|
|
18 |
ethernet = str(features.get('Ethernet LAN')[0])
|
|
|
19 |
|
|
|
20 |
if ethernet.find('1000 ') > -1:
|
|
|
21 |
ethernet_score = 10.0
|
|
|
22 |
elif ethernet.find('100') > -1:
|
|
|
23 |
ethernet_score = 7.0
|
|
|
24 |
else:
|
|
|
25 |
ethernet_score = 4.0
|
|
|
26 |
|
|
|
27 |
if features.has_key('Bluetooth'):
|
|
|
28 |
bluetooth = str(features.get('Bluetooth')[0])
|
|
|
29 |
bluetooth_score = 10.0 if bluetooth.find('3.0') else 7.0
|
|
|
30 |
|
|
|
31 |
score = (50.0 * wireless_score + 30.0 * ethernet_score + 10.0 * bluetooth_score) / 100
|
|
|
32 |
return score
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
print "expSlide=" + `expSlide`
|
|
|
36 |
|
|
|
37 |
struct = utils.contentModel2Struct(expSlide, categoryObj)
|
|
|
38 |
print "struct=" + `struct`
|
|
|
39 |
|
|
|
40 |
score = getscore(struct)
|