Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CaseRepositoryIntTest extends IntegrationBase {
private CaseRepository caseRepository;

@Test
void findByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_ReturnsResults() {
void findByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_ShouldReturnsResults() {
// given
caseStub.createAndSaveCourtCase(courtCase -> {
courtCase.setRetentionUpdated(true);
Expand Down Expand Up @@ -69,7 +69,7 @@ void findByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_ReturnsResults() {
}

@Test
void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_caseHasNoAssocaitedCaseRetentionEntity_shouldNotReturn() {
void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_ShouldNotReturn_WhenCaseHasNoAssociatedCaseRetentionEntity() {
// given
caseStub.createAndSaveCourtCase(courtCase -> {
courtCase.setRetentionUpdated(true);
Expand All @@ -82,7 +82,7 @@ void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_caseHasNoAssocai
}

@Test
void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_oneCaseHasMultipleRetentionObjects_shouldOnlyReturnIdOnce() {
void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_ShouldOnlyReturnIdOnce_WhereOneCaseHasMultipleRetentionObjects() {
// given
var matchingCase = caseStub.createAndSaveCourtCase(courtCase -> {
courtCase.setRetentionUpdated(true);
Expand All @@ -106,7 +106,7 @@ void findIdsByIsRetentionUpdatedTrueAndRetentionRetriesLessThan_oneCaseHasMultip


@Test
void findCasesIdsNeedingCaseDocumentGenerated_ReturnsMatchingCases() {
void findCasesIdsNeedingCaseDocumentGenerated_ShouldReturnsMatchingCases() {
// given
caseStub.createAndSaveCourtCase(courtCase -> {
courtCase.setClosed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ AND NOT EXISTS (select 1 from CaseRetentionEntity cre
""")
List<Integer> findOpenCasesToClose(OffsetDateTime cutoffDate, Limit limit);

// Must have join to case retention to ensure all cases returned have CaseRetentionEntity
@Query("""
SELECT distinct cc.id
FROM CourtCaseEntity cc
JOIN cc.caseRetentionEntities cr
WHERE cr is not null
AND cc.isRetentionUpdated = true
JOIN cc.caseRetentionEntities cr
WHERE cc.isRetentionUpdated = true
AND cc.retentionRetries < :maxRetentionRetries
ORDER BY cc.id ASC
""")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS cr_rr_idx ON case_retention (retention_retries);