Skip to content

Commit

Permalink
feat: add displayOrder
Browse files Browse the repository at this point in the history
OCD-4520
  • Loading branch information
tmy1313 committed Jan 9, 2025
1 parent 33e15b0 commit 74e2169
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import gov.healthit.chpl.compliance.surveillance.entity.NonconformityTypeEntity;
import gov.healthit.chpl.compliance.surveillance.entity.SurveillanceNonconformityEntity;
import gov.healthit.chpl.dao.impl.BaseDAOImpl;
import gov.healthit.chpl.service.CertificationCriterionService;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Repository
public class NonconformityReportDao extends BaseDAOImpl {

private CertificationCriterionService certificationCriterionService;

@Autowired
public NonconformityReportDao(CertificationCriterionService certificationCriterionService) {
this.certificationCriterionService = certificationCriterionService;
}

public List<NonconformityTypeCount> getNonconformityCounts() {
List<SurveillanceNonconformityEntity> allNonconformities = entityManager.createQuery(
"SELECT sne "
Expand All @@ -32,6 +41,7 @@ public List<NonconformityTypeCount> getNonconformityCounts() {
.filter(nc -> nc.getType().getId().equals(ncType.getId()))
.count())
.nonconformityType(ncType.toDomain())
.displayOrder(certificationCriterionService.getCertificationResultSortIndex(ncType.getId()))
.build())
.filter(ncCount -> !ncCount.getCount().equals(0L))
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
public class NonconformityTypeCount {
private NonconformityType nonconformityType;
private Long count;
private Integer displayOrder;
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public String coerceToCriterionNumberFormat(String input) {
return input;
}

private Integer getCertificationResultSortIndex(Long criterionId) {
public Integer getCertificationResultSortIndex(Long criterionId) {
Integer index = referenceSortingCriteriaList.indexOf(criterionId);
if (index.equals(-1)) {
// This is case when the criteria ID is not in the array, just make it last...
Expand Down

0 comments on commit 74e2169

Please sign in to comment.