Subversion Repositories SmartDukaan

Rev

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

Rev 323 Rev 1915
Line 1... Line 1...
1
def getscore(struct):
1
def getscore(struct):
-
 
2
    
-
 
3
    score = 0.0
-
 
4
    file_formats_score = 0.0
-
 
5
    streaming_score = 0.0
-
 
6
    live_tv_score = 0.0
-
 
7
    
-
 
8
    features = struct.get("features")
-
 
9
    
-
 
10
    if features.has_key("File formats") :
-
 
11
        file_formats = features.get("File formats")
-
 
12
        number_of_file_formats = len(file_formats)
-
 
13
        if number_of_file_formats <= 1 :
-
 
14
            file_formats_score = 4.0
-
 
15
        elif number_of_file_formats >= 5 :
-
 
16
            file_formats_score = 10.0
-
 
17
        else :
-
 
18
            file_formats_score = 2*number_of_file_formats
-
 
19
 
-
 
20
    if features.has_key("Streaming") :
-
 
21
        streaming_score = 10.0
-
 
22
                
-
 
23
    if features.has_key("Live TV") :
-
 
24
        live_tv_score = 10.0
-
 
25
 
-
 
26
    score = (50*file_formats_score + 25*streaming_score + 25*live_tv_score)/100
-
 
27
    
-
 
28
    print "file_formats_score" + `file_formats_score`
-
 
29
    print "streaming_score" + str(streaming_score)
-
 
30
    print "live_tv_score" + `live_tv_score`
-
 
31
    
2
    return 7
32
    return score
-
 
33