Subversion Repositories SmartDukaan

Rev

Rev 2571 | Rev 2657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2571 Rev 2655
Line 7... Line 7...
7
    twog_talktime_score = 0.0
7
    twog_talktime_score = 0.0
8
    threeg_talktime_score = 0.0
8
    threeg_talktime_score = 0.0
9
    twog_standbytime_score = 0.0
9
    twog_standbytime_score = 0.0
10
    threeg_standbytime_score = 0.0
10
    threeg_standbytime_score = 0.0
11
    usage_time_score = 0.0
11
    usage_time_score = 0.0
-
 
12
 
-
 
13
    category = struct.get("category")    
-
 
14
    
-
 
15
    min_battery_capacity = 800
-
 
16
    max_battery_capacity = 1800
12
    
17
    
-
 
18
    if category == "Tablets":
-
 
19
        min_battery_capacity = 1000
-
 
20
        max_battery_capacity = 5000
-
 
21
        
13
    if struct.has_key("features") :
22
    if struct.has_key("features") :
14
        features = struct.get("features")
23
        features = struct.get("features")
15
        
24
        
16
        battery_capacity = 0.0
25
        battery_capacity = 0.0
17
        last = "0"
26
        last = "0"
Line 28... Line 37...
28
                    battery_capacity = 1200
37
                    battery_capacity = 1200
29
            print `last`
38
            print `last`
30
            last = part
39
            last = part
31
            
40
            
32
        print "battery_capacity" + `battery_capacity`
41
        print "battery_capacity" + `battery_capacity`
33
        if battery_capacity < 800 :
42
        if battery_capacity < min_battery_capacity :
34
            battery_type_score = 3
43
            battery_type_score = 3
35
        elif battery_capacity > 1800 :
44
        elif battery_capacity > max_battery_capacity :
36
            battery_type_score = 10
45
            battery_type_score = 10
37
        else :
46
        else :
38
            battery_type_score = (battery_capacity - 800)/(1800-800)*7.0
47
            battery_type_score = (battery_capacity - min_battery_capacity)/(max_battery_capacity-min_battery_capacity)*7.0
39
            battery_type_score = battery_type_score + 3.0
48
            battery_type_score = battery_type_score + 3.0
40
            
49
            
41
        if features.has_key("Usage time") :
50
        if features.has_key("Usage time") :
42
            usage_time = features.get("Usage time")
51
            usage_time = features.get("Usage time")
43
            usage_time = usage_time[0]
52
            usage_time = usage_time[0]
Line 152... Line 161...
152
    print "twog_talktime_score" + `twog_talktime_score`
161
    print "twog_talktime_score" + `twog_talktime_score`
153
    print "threeg_talktime_score" + `threeg_talktime_score`
162
    print "threeg_talktime_score" + `threeg_talktime_score`
154
    print "twog_standbytime_score" + `twog_standbytime_score`
163
    print "twog_standbytime_score" + `twog_standbytime_score`
155
    print "threeg_standbytime_score" + `threeg_standbytime_score`
164
    print "threeg_standbytime_score" + `threeg_standbytime_score`
156
 
165
 
-
 
166
    if category == "Tablets":
-
 
167
        score = (100*battery_type_score)/100
157
    if usage_time_score != 0:
168
    elif usage_time_score != 0:
158
        score = (40*battery_type_score + 60*usage_time_score)/100
169
        score = (40*battery_type_score + 60*usage_time_score)/100
159
    elif threeg_talktime_score == 0:
170
    elif threeg_talktime_score == 0:
160
        score = (40*battery_type_score + 30*twog_talktime_score + 30*twog_standbytime_score )/100
171
        score = (40*battery_type_score + 30*twog_talktime_score + 30*twog_standbytime_score )/100
161
    else :
172
    else :
162
        score = (40*battery_type_score + 20*twog_talktime_score + 10*threeg_talktime_score + 20*twog_standbytime_score + 10*threeg_standbytime_score)/100
173
        score = (40*battery_type_score + 20*twog_talktime_score + 10*threeg_talktime_score + 20*twog_standbytime_score + 10*threeg_standbytime_score)/100