Updated response of application api

This commit is contained in:
nisha
2024-09-25 12:25:29 +05:30
parent b997fb3a5a
commit 49f5eb0883
6 changed files with 66 additions and 10 deletions

View File

@@ -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) {