Subversion Repositories SmartDukaan

Rev

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

Rev 1915 Rev 2454
Line 6... Line 6...
6
    battery_type_score = 0.0
6
    battery_type_score = 0.0
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
    
11
    usage_time_score = 0.0
12
    
12
    
13
    if struct.has_key("features") :
13
    if struct.has_key("features") :
14
        features = struct.get("features")
14
        features = struct.get("features")
15
        # REVISIT - Nokia power adaptor should get more points
15
        # REVISIT - Nokia power adaptor should get more points
16
        # Power Adaptor
16
        # Power Adaptor
Line 20... Line 20...
20
        battery_capacity = 0.0
20
        battery_capacity = 0.0
21
        last = "0"
21
        last = "0"
22
        battery_type = features.get("Battery type")
22
        battery_type = features.get("Battery type")
23
        battery_type = battery_type[0]
23
        battery_type = battery_type[0]
24
        battery_type = battery_type.split(" ")
24
        battery_type = battery_type.split(" ")
25
        print "*****"
-
 
-
 
25
 
26
        print battery_type
26
        print battery_type
27
        for part in battery_type:
27
        for part in battery_type:
28
            if part.find("mAh") > -1:
28
            if part.find("mAh") > -1:
29
                try:
29
                try:
30
                    battery_capacity = float(last)
30
                    battery_capacity = float(last)
Line 40... Line 40...
40
            battery_type_score = 10
40
            battery_type_score = 10
41
        else :
41
        else :
42
            battery_type_score = (battery_capacity - 800)/(1800-800)*7.0
42
            battery_type_score = (battery_capacity - 800)/(1800-800)*7.0
43
            battery_type_score = battery_type_score + 3.0
43
            battery_type_score = battery_type_score + 3.0
44
            
44
            
-
 
45
        if features.has_key("Usage time") :
-
 
46
            usage_time = features.get("Usage time")
-
 
47
            usage_time = usage_time[0]
-
 
48
            usage_time = usage_time.split(" ")
-
 
49
            usage_time = float(usage_time[0])
-
 
50
            if usage_time > 10 :
-
 
51
                usage_time_score = 10
-
 
52
            else:
-
 
53
                usage_time_score = usage_time
-
 
54
                
45
    # Max will be 1.5 * 7 = ceil(10.5) = 10 
55
    # Max will be 1.5 * 7 = ceil(10.5) = 10 
46
    if struct.has_key("childrenslides") :
56
    if struct.has_key("childrenslides") :
47
        childrenslides = struct.get("childrenslides")
57
        childrenslides = struct.get("childrenslides")
48
        
58
        
49
        if childrenslides.has_key("Capacity") :
59
        if childrenslides.has_key("Capacity") :
Line 147... Line 157...
147
    print "twog_talktime_score" + `twog_talktime_score`
157
    print "twog_talktime_score" + `twog_talktime_score`
148
    print "threeg_talktime_score" + `threeg_talktime_score`
158
    print "threeg_talktime_score" + `threeg_talktime_score`
149
    print "twog_standbytime_score" + `twog_standbytime_score`
159
    print "twog_standbytime_score" + `twog_standbytime_score`
150
    print "threeg_standbytime_score" + `threeg_standbytime_score`
160
    print "threeg_standbytime_score" + `threeg_standbytime_score`
151
 
161
 
152
                
162
    if usage_time_score != 0:
-
 
163
        score = (40*battery_type_score + 60*usage_time_score)
153
    if threeg_talktime_score == 0:
164
    elif threeg_talktime_score == 0:
154
        score = (40*battery_type_score + 30*twog_talktime_score + 30*twog_standbytime_score )/100
165
        score = (40*battery_type_score + 30*twog_talktime_score + 30*twog_standbytime_score )/100
155
    else :
166
    else :
156
        score = (40*battery_type_score + 20*twog_talktime_score + 10*threeg_talktime_score + 20*twog_standbytime_score + 10*threeg_standbytime_score)/100
167
        score = (40*battery_type_score + 20*twog_talktime_score + 10*threeg_talktime_score + 20*twog_standbytime_score + 10*threeg_standbytime_score)/100
157
    return score
168
    return score
158
169