Skip to content

Commit

Permalink
Merge pull request #386 from bcgov/feature/EDX-1278
Browse files Browse the repository at this point in the history
EDX-1278: Indigenous Headcount compare fix
  • Loading branch information
mightycox authored Jan 8, 2024
2 parents 4cbc384 + 617b1d5 commit c966416
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.IntStream;

@Component
@Slf4j
Expand Down Expand Up @@ -75,4 +76,22 @@ public List<HeadcountHeader> getHeaders(UUID sdcSchoolCollectionID) {
});
return headcountHeaderList;
}

@Override
public void setComparisonValues(List<HeadcountHeader> headcountHeaderList, List<HeadcountHeader> previousHeadcountHeaderList) {
IntStream.range(0, headcountHeaderList.size())
.forEach(i -> {
HeadcountHeader currentHeader = headcountHeaderList.get(i);
HeadcountHeader previousHeader = previousHeadcountHeaderList.get(i);

currentHeader.getColumns().forEach((columnName, currentColumn) -> {
HeadcountHeaderColumn previousColumn = previousHeader.getColumns().get(columnName);
currentColumn.setComparisonValue(previousColumn.getCurrentValue());
});

if(currentHeader.getHeadCountValue() != null && previousHeader.getHeadCountValue() != null) {
currentHeader.getHeadCountValue().setComparisonValue(previousHeader.getHeadCountValue().getCurrentValue());
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
COUNT(DISTINCT CASE WHEN s.nativeAncestryInd = 'Y' THEN 1 END) AS studentsWithIndigenousAncestry,
COUNT(DISTINCT CASE WHEN s.schoolFundingCode ='20' THEN 1 END) AS studentsWithFundingCode20,
COUNT(DISTINCT s.sdcSchoolCollectionStudentID) AS allStudents
FROM SdcSchoolCollectionStudentEntity s JOIN s.sdcStudentEnrolledProgramEntities ep
FROM SdcSchoolCollectionStudentEntity s LEFT JOIN s.sdcStudentEnrolledProgramEntities ep
WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID
""")
IndigenousHeadcountHeaderResult getIndigenousHeadersBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand Down

0 comments on commit c966416

Please sign in to comment.