Blame | Last modification | View Log | RSS feed
import utilsdef getscore(struct):score = 0.0weight_score = 0.0size_score = 0.0if struct.has_key('features'):features = struct.get('features')if features.has_key("Weight"):weight = features.get('Weight')if weight <= 1.5:weight_score = 10.0elif weight > 1.5 and weight <= 2.5:weight_score = 10.0 - (weight - 1.5) * 6else:weight_score = 4.0if features.has_key('Size'):size = features.get('Size')if len(size) > 2:thickness = float(size[2])if thickness <= 20.0:size_score = 10.0elif thickness > 20.0 and thickness < 40.0:size_score = 10 - (thickness - 20.0) * 6 / 20else:size_score = 4.0score = (60 * weight_score + 40 * size_score) / 100return scoreprint "expSlide=" + `expSlide`struct = utils.contentModel2Struct(expSlide, categoryObj)print "struct=" + `struct`score = getscore(struct)