feat(ranking): 스냅샷 완전 공백 조회를 추가한다
This commit is contained in:
@@ -28,6 +28,10 @@ class DefaultCreatorRankingSnapshotRepository(
|
||||
return repository.findPreviousCompletedSnapshots().map { it.toRecord() }
|
||||
}
|
||||
|
||||
override fun isSnapshotTableEmpty(): Boolean {
|
||||
return repository.count() == 0L
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override fun replaceSnapshots(
|
||||
aggregationStartAtUtc: LocalDateTime,
|
||||
|
||||
@@ -12,6 +12,8 @@ interface CreatorRankingSnapshotPort {
|
||||
|
||||
fun findPreviousCompletedSnapshots(): List<CreatorRankingSnapshotRecord>
|
||||
|
||||
fun isSnapshotTableEmpty(): Boolean
|
||||
|
||||
fun replaceSnapshots(
|
||||
aggregationStartAtUtc: LocalDateTime,
|
||||
aggregationEndAtUtc: LocalDateTime,
|
||||
|
||||
@@ -147,6 +147,22 @@ class DefaultCreatorRankingSnapshotRepositoryTest @Autowired constructor(
|
||||
assertEquals(emptyList<CreatorRankingSnapshotRecord>(), snapshots)
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("스냅샷 row가 하나도 없을 때만 테이블 완전 공백으로 판단한다")
|
||||
fun shouldReturnTrueOnlyWhenSnapshotTableHasNoRows() {
|
||||
assertEquals(true, adapter.isSnapshotTableEmpty())
|
||||
|
||||
repository.save(
|
||||
snapshot(
|
||||
creatorId = 1L,
|
||||
aggregationStartAtUtc = LocalDateTime.of(2026, 5, 24, 15, 0),
|
||||
aggregationEndAtUtc = LocalDateTime.of(2026, 5, 31, 15, 0)
|
||||
)
|
||||
)
|
||||
|
||||
assertEquals(false, adapter.isSnapshotTableEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("20위 점수 경계 동점 후보는 저장소에서 누락 없이 저장하고 조회할 수 있다")
|
||||
fun shouldPersistAllCandidatesTiedAtTwentiethScoreBoundary() {
|
||||
|
||||
@@ -256,6 +256,8 @@ private class FakeCreatorRankingSnapshotPort : CreatorRankingSnapshotPort {
|
||||
|
||||
override fun findPreviousCompletedSnapshots(): List<CreatorRankingSnapshotRecord> = snapshots
|
||||
|
||||
override fun isSnapshotTableEmpty(): Boolean = snapshots.isEmpty()
|
||||
|
||||
override fun replaceSnapshots(
|
||||
aggregationStartAtUtc: LocalDateTime,
|
||||
aggregationEndAtUtc: LocalDateTime,
|
||||
|
||||
Reference in New Issue
Block a user