Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 naveen 1
import battery_math as mathmodel
73 naveen 2
import utils
71 naveen 3
 
73 naveen 4
print "expSlide=" + `expSlide`
71 naveen 5
 
73 naveen 6
struct = utils.contentModel2Struct(expSlide)
7
print "struct=" + `struct`
8
 
75 naveen 9
newstruct = {}
10
 
11
# Copy features as is
12
if struct.has_key("features") :
13
    features = struct.get("features")
14
    newstruct['features'] = features
15
 
16
# Talktime and Standby time become 'childrenslides' and bullets go under 'features' > '2G'
17
if struct.has_key("childrenslides") :
18
    childrenslides = struct.get("childrenslides")
19
    newchildrenslides = {}
20
 
21
    if childrenslides.has_key("Capacity") :
22
        capacity = childrenslides.get("Capacity")
23
        newcapacity = {}
24
 
25
        if capacity.has_key("features") :
26
            features = capacity.get("features")
27
 
28
            if features.has_key("Talk time") :
29
                talktimebullets = features.get("Talk time")
30
                newtalktimefeatures = {}
31
                newtalktimefeatures['2G'] = talktimebullets
32
 
33
                newtalktime = {}
34
                newtalktime['features'] = newtalktimefeatures
35
                newcapacity['Talk time'] = newtalktime
36
 
37
            if features.has_key("Standby time") :
38
                standbytimebullet = features.get("Standby time")
39
                newstandbytimefeatures = {}
40
                newstandbytimefeatures['2G'] = standbytimebullet
41
 
42
                newstandbytime = {}
43
                newstandbytime['features'] = newstandbytimefeatures
44
                newcapacity['Standby time'] = newstandbytime
45
 
76 naveen 46
        newcapacitychildrenslides = {}
47
        newcapacitychildrenslides['childrenslides'] = newcapacity
48
        newchildrenslides['Capacity'] = newcapacitychildrenslides
75 naveen 49
 
50
    newstruct['childrenslides'] = newchildrenslides 
51
 
52
print "newstruct=" + `newstruct`
53
score = mathmodel.getscore(newstruct)