Subversion Repositories SmartDukaan

Rev

Rev 323 | Blame | Compare with Previous | Last modification | View Log | RSS feed

import battery_math as mathmodel
import utils

print "expSlide=" + `expSlide`

struct = utils.contentModel2Struct(expSlide, categoryObj)
print "struct=" + `struct`

newstruct = {}

# Copy features as is
if struct.has_key("features") :
    features = struct.get("features")
    newstruct['features'] = features
    
# Talktime and Standby time become 'childrenslides' and bullets go under 'features' > '2G'
if struct.has_key("childrenslides") :
    childrenslides = struct.get("childrenslides")
    newchildrenslides = {}
    
    if childrenslides.has_key("Capacity") :
        capacity = childrenslides.get("Capacity")
        newcapacity = {}
        
        if capacity.has_key("features") :
            features = capacity.get("features")
            
            if features.has_key("Talk time") :
                talktimebullets = features.get("Talk time")
                newtalktimefeatures = {}
                newtalktimefeatures['2G'] = talktimebullets
                
                newtalktime = {}
                newtalktime['features'] = newtalktimefeatures
                newcapacity['Talk time'] = newtalktime
                
            if features.has_key("Standby time") :
                standbytimebullet = features.get("Standby time")
                newstandbytimefeatures = {}
                newstandbytimefeatures['2G'] = standbytimebullet
                
                newstandbytime = {}
                newstandbytime['features'] = newstandbytimefeatures
                newcapacity['Standby time'] = newstandbytime
        
        newcapacitychildrenslides = {}
        newcapacitychildrenslides['childrenslides'] = newcapacity
        newchildrenslides['Capacity'] = newcapacitychildrenslides
        
    newstruct['childrenslides'] = newchildrenslides 
        
print "newstruct=" + `newstruct`
score = mathmodel.getscore(newstruct)