fixed evaluation criteria issue
This commit is contained in:
@@ -75,6 +75,9 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
@Autowired
|
||||
ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
|
||||
@@ -168,41 +171,42 @@ public class ApplicationEvaluationDao {
|
||||
private List<CriteriaMappedField> getMappedFieldsForCriteria(Long evaluationCriteriaId, Long applicationId) {
|
||||
List<CriteriaFormFieldEntity> criteriaFormFields = criteriaFormFieldRepository.findByEvaluationCriteriaIdAndIsDeletedFalse(evaluationCriteriaId);
|
||||
List<CriteriaMappedField> mappedFields = new ArrayList<>();
|
||||
Set<String> uniqueFieldIds = new HashSet<>();
|
||||
|
||||
List<ApplicationFormEntity> applicationForms = applicationFormRepository.findByApplicationId(applicationId);
|
||||
|
||||
for (ApplicationFormEntity applicationForm : applicationForms) {
|
||||
Set<String> uniqueFieldIds = new HashSet<>();
|
||||
|
||||
for (CriteriaFormFieldEntity formField : criteriaFormFields) {
|
||||
String formFieldId = formField.getFormFieldId();
|
||||
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity == null || !formEntity.getId().equals(formField.getFormId())) {
|
||||
continue;
|
||||
}
|
||||
if (!uniqueFieldIds.contains(formFieldId)) {
|
||||
CriteriaMappedField mappedField = new CriteriaMappedField();
|
||||
mappedField.setId(formFieldId);
|
||||
|
||||
FormEntity formEntity = getFormEntity(formField.getFormId());
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentBeans.stream()
|
||||
.filter(contentBean -> contentBean.getId().equals(formFieldId))
|
||||
.findFirst()
|
||||
.ifPresent(contentBean -> {
|
||||
mappedField.setFieldLabel(getLabelForField(contentBean));
|
||||
switch (contentBean.getName()) {
|
||||
case "fileupload":
|
||||
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
||||
break;
|
||||
|
||||
case "checkboxes":
|
||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||
break;
|
||||
case "paragraph":
|
||||
handleParagraphField(applicationId, formField, contentBean, mappedField);
|
||||
break;
|
||||
default:
|
||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
contentBeans.stream()
|
||||
.filter(contentBean -> contentBean.getId().equals(formFieldId))
|
||||
.findFirst()
|
||||
.ifPresent(contentBean -> {
|
||||
mappedField.setFieldLabel(getLabelForField(contentBean));
|
||||
switch (contentBean.getName()) {
|
||||
case "fileupload":
|
||||
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
||||
break;
|
||||
case "checkboxes":
|
||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||
break;
|
||||
case "paragraph":
|
||||
handleParagraphField(applicationId, formField, contentBean, mappedField);
|
||||
break;
|
||||
default:
|
||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||
}
|
||||
});
|
||||
|
||||
mappedFields.add(mappedField);
|
||||
uniqueFieldIds.add(formFieldId);
|
||||
@@ -314,7 +318,8 @@ public class ApplicationEvaluationDao {
|
||||
applicationFormEntities.forEach(applicationForm -> {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
@@ -682,7 +687,8 @@ public class ApplicationEvaluationDao {
|
||||
ApplicationFormEntity applicationForm, Long applicationId) {
|
||||
mappedField.setId(formFieldId);
|
||||
formRepository.findById(criteriaFormField.getFormId()).ifPresent(formEntity -> {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.stream().filter(bean -> bean.getId().equals(formFieldId)).findFirst().ifPresent(contentResponseBean -> {
|
||||
String label = getLabel(contentResponseBean);
|
||||
mappedField.setFieldLabel(label);
|
||||
@@ -828,7 +834,8 @@ public class ApplicationEvaluationDao {
|
||||
applicationFormEntities.forEach(applicationForm -> {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.forEach(contentResponseBean -> {
|
||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||
String label = null;
|
||||
@@ -960,7 +967,8 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
FormEntity formEntity = formRepository.findById(criteriaFormField.getFormId()).orElse(null);
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
contentResponseBeans.stream()
|
||||
.filter(bean -> bean.getId().equals(criteriaFormField.getFormFieldId()))
|
||||
.findFirst()
|
||||
@@ -1125,7 +1133,8 @@ public class ApplicationEvaluationDao {
|
||||
FormEntity formEntity = applicationForm.getForm();
|
||||
|
||||
if (formEntity != null) {
|
||||
List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||
|
||||
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||
if ("fileupload".equals(contentResponseBean.getName())) {
|
||||
|
||||
Reference in New Issue
Block a user