feat(home): 인기 커뮤니티 점수에서 팔로워 항목을 제거한다
This commit is contained in:
@@ -80,13 +80,11 @@ class RecommendationScorePolicy {
|
|||||||
fun calculateCommunityScore(
|
fun calculateCommunityScore(
|
||||||
likeCount: Long,
|
likeCount: Long,
|
||||||
commentCount: Long,
|
commentCount: Long,
|
||||||
followerCount: Long,
|
|
||||||
newBoost: Double
|
newBoost: Double
|
||||||
): Double {
|
): Double {
|
||||||
return (
|
return (
|
||||||
(RecommendationScoreSpec.COMMUNITY_LIKE_WEIGHT * likeCount) +
|
(RecommendationScoreSpec.COMMUNITY_LIKE_WEIGHT * likeCount) +
|
||||||
(RecommendationScoreSpec.COMMUNITY_COMMENT_WEIGHT * commentCount) +
|
(RecommendationScoreSpec.COMMUNITY_COMMENT_WEIGHT * commentCount)
|
||||||
(RecommendationScoreSpec.COMMUNITY_FOLLOWER_WEIGHT * followerCount)
|
|
||||||
) * newBoost
|
) * newBoost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ object RecommendationScoreSpec {
|
|||||||
const val CHEER_DONATION_COUNT_WEIGHT = 0.1
|
const val CHEER_DONATION_COUNT_WEIGHT = 0.1
|
||||||
|
|
||||||
const val COMMUNITY_LIKE_WEIGHT = 0.5
|
const val COMMUNITY_LIKE_WEIGHT = 0.5
|
||||||
const val COMMUNITY_COMMENT_WEIGHT = 0.4
|
const val COMMUNITY_COMMENT_WEIGHT = 0.5
|
||||||
const val COMMUNITY_FOLLOWER_WEIGHT = 0.1
|
|
||||||
|
|
||||||
const val NEW_BOOST_10_DAYS = 1.5
|
const val NEW_BOOST_10_DAYS = 1.5
|
||||||
const val NEW_BOOST_20_DAYS = 1.3
|
const val NEW_BOOST_20_DAYS = 1.3
|
||||||
|
|||||||
@@ -112,18 +112,16 @@ class RecommendationScorePolicyTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("인기 커뮤니티 점수는 좋아요 수, 댓글 수, 팔로우 수에 가중치를 적용한다")
|
@DisplayName("인기 커뮤니티 점수는 좋아요 수와 댓글 수에 가중치를 적용한다")
|
||||||
fun shouldCalculateCommunityScore() {
|
fun shouldCalculateCommunityScore() {
|
||||||
assertEquals(0.5, RecommendationScoreSpec.COMMUNITY_LIKE_WEIGHT, 0.0001)
|
assertEquals(0.5, RecommendationScoreSpec.COMMUNITY_LIKE_WEIGHT, 0.0001)
|
||||||
assertEquals(0.4, RecommendationScoreSpec.COMMUNITY_COMMENT_WEIGHT, 0.0001)
|
assertEquals(0.5, RecommendationScoreSpec.COMMUNITY_COMMENT_WEIGHT, 0.0001)
|
||||||
assertEquals(0.1, RecommendationScoreSpec.COMMUNITY_FOLLOWER_WEIGHT, 0.0001)
|
|
||||||
|
|
||||||
assertEquals(0.0, policy.calculateCommunityScore(0, 0, 0, 1.0), 0.0001)
|
assertEquals(0.0, policy.calculateCommunityScore(0, 0, 1.0), 0.0001)
|
||||||
assertEquals(5.0, policy.calculateCommunityScore(10, 0, 0, 1.0), 0.0001)
|
assertEquals(5.0, policy.calculateCommunityScore(10, 0, 1.0), 0.0001)
|
||||||
assertEquals(4.0, policy.calculateCommunityScore(0, 10, 0, 1.0), 0.0001)
|
assertEquals(5.0, policy.calculateCommunityScore(0, 10, 1.0), 0.0001)
|
||||||
assertEquals(1.0, policy.calculateCommunityScore(0, 0, 10, 1.0), 0.0001)
|
assertEquals(30.0, policy.calculateCommunityScore(40, 20, 1.0), 0.0001)
|
||||||
assertEquals(38.0, policy.calculateCommunityScore(40, 20, 100, 1.0), 0.0001)
|
assertEquals(34.5, policy.calculateCommunityScore(40, 20, 1.15), 0.0001)
|
||||||
assertEquals(43.7, policy.calculateCommunityScore(40, 20, 100, 1.15), 0.0001)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user