コード例 #1
0
 def deleteItem(self, itemId=None):
     itemId = itemId if itemId != None else self.form.itemId
     itemDB = QueryItem().getItemByItem(itemId)
     evaluations = QueryEvaluation().getListEvaluationsByItem(itemId)
     for evaluation in evaluations :
         self.deleteEvaluation(evaluation.id)
     itemDB.delete()
コード例 #2
0
 def is_valid(self):
     items = QueryItem().getListItemsByEvaluationSystem(self.evaluationSystem)
     total = 0.0
     for item in items:
         evaluations = QueryEvaluation().getListEvaluationsByItem(item)
         for evaluation in evaluations:
             total += evaluation.getPercentage()
     
     if abs(total-100)<0.01 :
         self.errors = None
         return True
     else:
         self.errors = "Els percentatges de les evaluacions han de sumar el 100%."
         return False
コード例 #3
0
 def datosIniciales(self):
     self.item = QueryItem().getItemByItem(self.itemId)
     data = {}
     if (self.field == "hito"):
         data = {"nombre": self.item.nombre,
                  "plazo": self.item.plazo
         }
     elif (self.field == "evaluacion"):
         self.evaluation = QueryEvaluation().getEvaluationByEvaluation(self.evaluationId)
         data = {"nombre": self.evaluation.nombre,
                  "evaluador": self.evaluation.evaluador,
                  "porcentaje": self.evaluation.porcentaje
         }
     elif (self.field == "pregunta"):
         self.question = QueryQuestion().getQuestionByQuestion(self.questionId)
         data = {"pregunta": self.question.pregunta,
                  "tipoRespuesta": self.question.tipoRespuesta
         }
     
     return data
コード例 #4
0
 def createEvaluation(self):
     item = QueryItem().getItemByItem(self.form.itemId)
     self.form.evaluation.hito = item
     self.form.evaluation.save()
コード例 #5
0
 def editItem(self):
     itemDB = QueryItem().getItemByItem(self.form.itemId)
     itemDB.nombre, itemDB.plazo = self.form.item.nombre, self.form.item.plazo 
     itemDB.save()
コード例 #6
0
 def createItem(self):
     self.form.item.sistemaEvaluacion = QueryEvaluationSystem().getEvaluationSystemByCourseSelected(self.form.request)
     self.form.item.orden =  len(QueryItem().getListItemsByEvaluationSystem(self.form.item.sistemaEvaluacion)) + 1
     self.form.item.save()