fix(content-recommendation): 최신성 점수 계산 기준을 보정한다
This commit is contained in:
@@ -679,3 +679,4 @@ interface AudioRecommendationQueryPort {
|
||||
- 2026-06-23 리뷰 보정 검증: `./gradlew --stop && ./gradlew clean test --tests kr.co.vividnext.sodalive.v2.audio.recommendation.application.AudioRecommendationQueryServiceTest --tests kr.co.vividnext.sodalive.v2.audio.recommendation.application.AudioRecommendationSnapshotRefreshServiceTest --tests kr.co.vividnext.sodalive.v2.audio.recommendation.domain.AudioRecommendationScorePolicyTest`: `BUILD SUCCESSFUL`.
|
||||
- 2026-06-23 리뷰 보정 검증: repository focused test는 병렬 Gradle 실행 중 `kaptGenerateStubsTestKotlin` 출력 디렉터리 충돌로 1회 실패해 단독 재실행했다. H2 `MODE=MySQL`의 `TIMESTAMPDIFF` 경계 동작이 운영 MySQL 공식 기준과 달라 신규 repository 경계 테스트는 제거하고 Kotlin 정책 테스트로 24시간 경계를 고정했다. 최종 `./gradlew test --tests kr.co.vividnext.sodalive.v2.audio.recommendation.adapter.out.persistence.DefaultAudioRecommendationQueryRepositoryTest`: `BUILD SUCCESSFUL`.
|
||||
- 2026-06-23 리뷰 보정 검증: `./gradlew ktlintCheck`: `BUILD SUCCESSFUL`, `git diff --check`: 출력 없음.
|
||||
- 2026-06-25 후속 보정: `DefaultAudioRecommendationQueryRepositoryTest.shouldFindNewAndHotSnapshotsWithVisibility`의 score 비교 실패 원인은 repository native SQL의 `timestampdiff(day, c.release_date, :snapshotAt)` 최신성 계산이 DB 날짜 경계 기준에 의존해 `AudioRecommendationScorePolicy`의 24시간 경과 기준 `ChronoUnit.DAYS` 계산과 어긋날 수 있는 점으로 확인했다. `DefaultAudioRecommendationQueryRepository`의 New & Hot/추천 오디오 공개일 최신성 계산을 `floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24)`로 변경해 Kotlin 정책과 일치시켰고, `SAFE` 성인 콘텐츠 제외 조건은 기존 `(:includeAdult = true or c.is_adult = false)` 구현이 올바른 것으로 확인했다. 검증은 `./gradlew test --rerun-tasks --tests 'kr.co.vividnext.sodalive.v2.content.recommendation.adapter.out.persistence.DefaultAudioRecommendationQueryRepositoryTest.shouldFindNewAndHotSnapshotsWithVisibility'`, `./gradlew test --rerun-tasks --tests 'kr.co.vividnext.sodalive.v2.content.recommendation.domain.AudioRecommendationScorePolicyTest'`, `./gradlew ktlintCheck` 모두 `BUILD SUCCESSFUL`로 완료했다.
|
||||
|
||||
@@ -258,9 +258,9 @@ class DefaultAudioRecommendationQueryRepository(
|
||||
+ coalesce(l.like_count, 0) * 15.0
|
||||
+ coalesce(cm.comment_count, 0) * 15.0
|
||||
+ case
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 3 then 1.3
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 7 then 1.15
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 14 then 1.0
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 3 then 1.3
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 7 then 1.15
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 14 then 1.0
|
||||
else 0.8
|
||||
end * 35.0
|
||||
""".trimIndent()
|
||||
@@ -309,9 +309,9 @@ class DefaultAudioRecommendationQueryRepository(
|
||||
+ coalesce(l.like_count, 0) * 25.0
|
||||
+ coalesce(cm.comment_count, 0) * 20.0
|
||||
+ case
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 3 then 1.3
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 7 then 1.15
|
||||
when timestampdiff(day, c.release_date, :snapshotAt) <= 30 then 1.1
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 3 then 1.3
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 7 then 1.15
|
||||
when floor(timestampdiff(hour, c.release_date, :snapshotAt) / 24) <= 30 then 1.1
|
||||
else 1.0
|
||||
end * 10.0
|
||||
""".trimIndent()
|
||||
|
||||
Reference in New Issue
Block a user