Skip to content

Commit

Permalink
Merge pull request #374 from bcgov/fix/edx-1916
Browse files Browse the repository at this point in the history
Filter out expired collection types
  • Loading branch information
mightycox authored Dec 21, 2023
2 parents f6f650b + ae23812 commit d93c3b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public interface CollectionTypeCodeRepository extends JpaRepository<CollectionTy

List<CollectionTypeCodeEntity> findAllByOpenDateBeforeAndEffectiveDateLessThanAndExpiryDateGreaterThan(LocalDateTime dateTime, LocalDateTime dateTimeGreat, LocalDateTime dateTimeLess);

List<CollectionTypeCodeEntity> findAllByExpiryDateAfter(LocalDateTime now);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -95,7 +96,8 @@ public List<GenderCodeEntity> getAllGenderCodes() {

@Cacheable("collectionCodes")
public List<CollectionTypeCodeEntity> getCollectionCodeList() {
return collectionCodeRepository.findAll();

return collectionCodeRepository.findAllByExpiryDateAfter(LocalDateTime.now());
}

@Cacheable("schoolGradeCodes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public SchoolFundingGroupCodeEntity createSchoolFundingGroupCodeData() {

public CollectionTypeCodeEntity createCollectionTypeCodeData() {
return CollectionTypeCodeEntity.builder().collectionTypeCode("SEPTEMBER").label("September").description("September collection")
.displayOrder(10).effectiveDate(LocalDateTime.now()).expiryDate(LocalDateTime.MAX).openDate(LocalDateTime.now().minusMonths(1))
.displayOrder(10).effectiveDate(LocalDateTime.now()).expiryDate(LocalDateTime.now().plusYears(10)).openDate(LocalDateTime.now().minusMonths(1))
.closeDate(LocalDateTime.now().plusMonths(1)).createUser("TEST").snapshotDate(LocalDate.now()).updateUser("TEST").build();
}

Expand Down

0 comments on commit d93c3b4

Please sign in to comment.