Updated response of application api
This commit is contained in:
@@ -290,21 +290,31 @@ public class FlowFormDao {
|
||||
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
|
||||
|
||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
||||
Long totalFormSteps = 3l;
|
||||
if (flowEdgesList.size() == 1) {
|
||||
totalFormSteps = 2l;
|
||||
}
|
||||
Long totalFormSteps = calculateTotalSteps(flowEdgesList);
|
||||
Long currentStep = calculateCurrentStep(formEntity);
|
||||
List<ApplicationFormEntity> applicationFormList = applicationFormRepository.findByApplicationId(applicationEntity.getId());
|
||||
nextOrPreviousFormResponse.setTotalFormSteps(totalFormSteps);
|
||||
nextOrPreviousFormResponse.setCompletedSteps(Long.valueOf(applicationFormList.size()));
|
||||
nextOrPreviousFormResponse.setCurrentStep(currentStep);
|
||||
return nextOrPreviousFormResponse;
|
||||
}
|
||||
|
||||
public Long calculateCurrentStep(FormEntity formEntity) {
|
||||
Long currentStep = 2l;
|
||||
if (formEntity.getId().equals(formEntity.getCall().getInitialForm())) {
|
||||
currentStep = 1l;
|
||||
} else if (formEntity.getId().equals(formEntity.getCall().getFinalForm())) {
|
||||
currentStep = 3l;
|
||||
}
|
||||
List<ApplicationFormEntity> applicationFormList = applicationFormRepository.findByApplicationId(applicationEntity.getId());
|
||||
nextOrPreviousFormResponse.setTotalFormSteps(totalFormSteps);
|
||||
nextOrPreviousFormResponse.setCompletedSteps(Long.valueOf(applicationFormList.size()));
|
||||
nextOrPreviousFormResponse.setCurrentStep(currentStep);
|
||||
return nextOrPreviousFormResponse;
|
||||
return currentStep;
|
||||
}
|
||||
|
||||
public Long calculateTotalSteps(List<FlowEdgesEntity> flowEdgesList) {
|
||||
Long totalFormSteps = 3l;
|
||||
if (flowEdgesList.size() == 1) {
|
||||
totalFormSteps = 2l;
|
||||
}
|
||||
return totalFormSteps;
|
||||
}
|
||||
|
||||
private Long getDefaultForm(ApplicationEntity applicationEntity) {
|
||||
|
||||
Reference in New Issue
Block a user