Subversion Repositories SmartDukaan

Rev

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

Rev 1936 Rev 2051
Line 1... Line 1...
1
import math
1
import math
2
from math import sqrt
2
from math import sqrt, log
3
 
3
 
4
 
4
 
5
def getscore(struct):
5
def getscore(struct):
6
    
6
    
7
    score = 0.0
7
    score = 0.0
Line 17... Line 17...
17
            
17
            
18
            if len(builtin) > 0 :
18
            if len(builtin) > 0 :
19
                builtin = float(builtin[0])
19
                builtin = float(builtin[0])
20
                print "builtin=" + `builtin`
20
                print "builtin=" + `builtin`
21
                
21
                
22
                if builtin <= 1024 :
22
                if builtin <= 1024:
23
                    builtin_score = 0.0
23
                    builtin_score = 0.0
24
                    
24
                    
-
 
25
                elif builtin < 1024*128:
-
 
26
                    builtin_score = 1.0
-
 
27
                     
25
                elif builtin >= 16*1024*1024 :
28
                elif builtin >= 64*1024*1024 :
26
                    builtin_score = 10.0 
29
                    builtin_score = 10.0 
27
                
30
                
28
                else :
31
                else :
29
                    builtin_score = 10 - (sqrt(16*1024*1024) - sqrt(builtin)) / (sqrt(16*1024*1024) - sqrt(1024)) * 10 
32
                    builtin_score = log(builtin/1024*64, 2)
30
                      
33
                      
31
        # REVISIT
34
        # REVISIT
32
        # Expansion Type : microSD-2, others-1
35
        # Expansion Type : microSD-2, others-1
33
        if features.has_key("Expansion type") :
36
        if features.has_key("Expansion type") :
34
            expansion_type = features.get("Expansion type")
37
            expansion_type = features.get("Expansion type")