Subversion Repositories SmartDukaan

Rev

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

Rev 4036 Rev 5173
Line 17... Line 17...
17
            if ram <= 2.0:
17
            if ram <= 2.0:
18
                ram_score = 4
18
                ram_score = 4
19
            elif ram > 2.0 and ram < 4.0:
19
            elif ram > 2.0 and ram < 4.0:
20
                ram_score = 4 + (ram - 2.0) * 6.0 / 2
20
                ram_score = 4 + (ram - 2.0) * 6.0 / 2
21
            else:
21
            else:
22
                ram_score = 10
22
                ram_score = 10.0
23
            
23
             
24
        if features.has_key('Expansion capacity'):
24
        if features.has_key('Expansion capacity'):
-
 
25
            #convert to GBs
25
            expansion_capacity = features.get('Expansion capacity')
26
            expansion_capacity = float(features.get('Expansion capacity')[0])/(1024.0*1024.0)
26
            
-
 
27
            if expansion_capacity == 0:
27
            if expansion_capacity == 0:
28
                expansion_capacity_score = 0
28
                expansion_capacity_score = 0
29
            elif expansion_capacity == 2:
29
            elif expansion_capacity == 2:
30
                expansion_capacity_score = 2.5
30
                expansion_capacity_score = 2.5
31
            elif expansion_capacity == 4:
31
            elif expansion_capacity == 4:
32
                expansion_capacity_score = 5
32
                expansion_capacity_score = 5
33
            elif expansion_capacity == 8:
33
            elif expansion_capacity == 8:
34
                expansion_capacity_score = 7.5
34
                expansion_capacity_score = 7.5
35
            elif expansion_capacity ==16:
35
            elif expansion_capacity ==16:
36
                expansion_capacity_score = 10
36
                expansion_capacity_score = 10.0
37
            
37
            
38
        if features.has_key('RAM type'):
38
        if features.has_key('RAM type'):
39
            ram_type = features.get('RAM type')
39
            ram_type = features.get('RAM type')[0].encode()
40
            ram_type_score = 10 if ram_type == 'DDR3' else 5
40
            ram_type_score = 10 if ram_type == 'DDR3' else 5
41
        
-
 
42
        if features.has_key('Memory clock speed'):
41
        if features.has_key('Memory clock speed'):
43
            pass                                    #TODO
42
            pass                                    #TODO
44
        
43
        
45
    score = (70 * ram_score + 15 * expansion_capacity_score + 15 * ram_type_score) / 100
44
    score = (70 * ram_score + 10 * expansion_capacity_score + 20 * ram_type_score) / 100.0
46
    return score
45
    return score
47
 
46
 
48
print "expSlide=" + `expSlide`
47
print "expSlide=" + `expSlide`
49
 
48
 
50
struct = utils.contentModel2Struct(expSlide, categoryObj)
49
struct = utils.contentModel2Struct(expSlide, categoryObj)