def post(self, request): json_data = json.loads(request.body) criterion_name = json_data['name'] qualitative_values = json_data['qualitative'] quantitative_values = json_data['quantitative'] print(qualitative_values) print(quantitative_values) CriterionCatalog.get_instance().delete_if_exists(criterion_name) is_quantitative = (len(quantitative_values) != 0) is_qualitative = (len(qualitative_values) != 0) criterion = EvaluationCriterion(_name=criterion_name, _is_quantitative=is_quantitative, _is_qualitative=is_qualitative) criterion.save() for val in qualitative_values: name = val option = QualitativeOptions(_criterion=criterion, _name=name) option.save() for val in quantitative_values: name = val['name'] beginning = val['beginning'] end = val['end'] option = QuantitativeOption(_criterion=criterion, _name=name, _beginning=beginning, _end=end) option.save() return HttpResponseRedirect('/management/viewCriterion/')
def get(self, request): evaluator = request.user evaluatee = AssignmentCatalog.get_instance().get_evaluatee_list( evaluator) criterion = CriterionCatalog.get_instance().dump_all() data = {'evaluatee': evaluatee, 'criterion': criterion} html = self.template.render(data, request) return HttpResponse(html)
def get(self, request, criterion_name=None): data = None if criterion_name is not None: data = CriterionCatalog.get_instance().dump_by_name(criterion_name) t = get_template('management/addCriterion.html') html = t.render(data, request) return HttpResponse(html)
def post(self, request): data = json.loads(request.body) criterion_catalog = CriterionCatalog.get_instance() for json_data in data: criterion_name = json_data['name'] reward_method = json_data['reward'] punishment_method = json_data['punishment'] criterion = criterion_catalog.get_by_name(criterion_name) criterion.set_reward(reward_method) criterion.set_punishment(punishment_method) return HttpResponseRedirect('/')
def _add_evaluation(evaluatee_username, criteria, evaluator): user_catalog = UserCatalog.get_instance() criterion_catalog = CriterionCatalog.get_instance() evaluation_catalog = EvaluationCatalog.get_instance() for result in criteria: evaluatee = user_catalog.get_by_username(evaluatee_username) criterion = criterion_catalog.get_by_name(result['name']) qualitative_result = result['qualitative'] quantitative_result = result['quantitative'] evaluation_catalog.evaluate_employee(evaluatee, criterion, evaluator, quantitative_result, qualitative_result)
def get(self, request): criteria = CriterionCatalog.get_instance().get_names_and_rnp() html = self.template.render({ 'criteria': criteria, }, request) return HttpResponse(html)
def get(self, request): criterion_names = CriterionCatalog.get_instance().get_names() t = get_template('management/viewCriteriaList.html') html = t.render({'criterion_names': criterion_names}, request) return HttpResponse(html)
def get(self, request, criterion_name): CriterionCatalog.get_instance().delete_if_exists(criterion_name) return HttpResponseRedirect('/management/viewCriterion/')