Пример #1
0
	def scoreUpdate(self, **kw):
		print "-------------"
		print kw
		id = kw['id']
		value = kw['value']
				
		score = Score.get(int(id))
		crit = score.criterion
		assessment = score.assessment
		category = crit.category
		
		score.value = value
			
		user = identity.current.user		
		eh = EditHistory.selectBy(assessmentID=assessment.id, category=category)
		if eh.count() > 0:
			eh[0].editor = user.firstlast()
			eh[0].program = user.program.name
		else:
			EditHistory(assessmentID=assessment.id, category=category, editor=user.firstlast(), program=user.program.name)
		
		if crit.prefix in ['Y','Z']:
			st_crit = Criterion.selectBy(level=assessment.level, category=category, prefix="Z")[0]
			na_crit = Criterion.selectBy(level=assessment.level, category=category, prefix="Y")[0]
			
			possible = util.scorePossible(category, assessment.level)
			subtotal = Score.selectBy(criterionID=st_crit.id, assessmentID=assessment.id)[0].value
			na = Score.selectBy(criterionID=na_crit.id, assessmentID=assessment.id)[0].value
			
			return str(util.percent(subtotal,possible,na))
			
		return dict()