Subversion Repositories SmartDukaan

Rev

Rev 323 | Rev 1936 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 naveen 1
def getscore(struct):
1915 rajveer 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
 
32
    return score
33