use of org.collectiveone.modules.assignations.dto.EvaluationGradeDto in project CollectiveOneWebapp by CollectiveOne.
the class AssignationService method evaluateAssignation.
@Transactional
private PostResult evaluateAssignation(UUID evaluatorUserId, UUID assignationId, EvaluationDto evaluationsDto) {
Assignation assignation = assignationRepository.findById(assignationId);
Evaluator evaluator = evaluatorRepository.findByAssignationIdAndUser_C1Id(assignation.getId(), evaluatorUserId);
if (evaluator != null) {
for (EvaluationGradeDto evaluationGradeDto : evaluationsDto.getEvaluationGrades()) {
UUID receiverUserId = UUID.fromString(evaluationGradeDto.getReceiverUser().getC1Id());
EvaluationGrade grade = evaluationGradeRepository.findByAssignation_IdAndReceiver_User_C1IdAndEvaluator_User_C1Id(assignation.getId(), receiverUserId, evaluatorUserId);
grade.setPercent(evaluationGradeDto.getPercent());
grade.setType(EvaluationGradeType.valueOf(evaluationGradeDto.getType()));
grade.setState(EvaluationGradeState.DONE);
evaluationGradeRepository.save(grade);
}
evaluator.setState(EvaluatorState.DONE);
evaluatorRepository.save(evaluator);
return new PostResult("success", "evaluation saved", evaluator.getId().toString());
} else {
return new PostResult("error", "evaluator not found", "");
}
}
use of org.collectiveone.modules.assignations.dto.EvaluationGradeDto in project CollectiveOneWebapp by CollectiveOne.
the class EvaluationGrade method toDto.
public EvaluationGradeDto toDto() {
EvaluationGradeDto dto = new EvaluationGradeDto();
dto.setId(id.toString());
if (evaluator != null)
dto.setEvaluatorUser(evaluator.getUser().toDtoLight());
if (receiver != null)
dto.setReceiverUser(receiver.getUser().toDtoLight());
if (type != null)
dto.setType(type.toString());
if (state != null)
dto.setState(state.toString());
dto.setPercent(percent);
return dto;
}
Aggregations