diff --git a/src/main/kotlin/com/ohayo/moyamoya/api/play/core/MatchingHelper.kt b/src/main/kotlin/com/ohayo/moyamoya/api/play/core/MatchingHelper.kt index 606b26b..900e0b3 100644 --- a/src/main/kotlin/com/ohayo/moyamoya/api/play/core/MatchingHelper.kt +++ b/src/main/kotlin/com/ohayo/moyamoya/api/play/core/MatchingHelper.kt @@ -69,7 +69,7 @@ object MatchingHelper { from.idealType.heightLevel != HeightLevel.ANY && idealTypeHeightLevels.contains(from.idealType.heightLevel) ) 10 else 0) + // 키 - (if (from.idealType.ageType.isMatched(from.user.schoolGrade, to.user.schoolGrade)) 10 else -10) + // 나이 + from.idealType.ageType.score(from.user.schoolGrade, to.user.schoolGrade) + // 나이 from.myInfo.mbti.score(to.myInfo.mbti) // 성격 (mbti) return score } diff --git a/src/main/kotlin/com/ohayo/moyamoya/core/user/profile/AgeType.kt b/src/main/kotlin/com/ohayo/moyamoya/core/user/profile/AgeType.kt index f27f73b..14934e6 100644 --- a/src/main/kotlin/com/ohayo/moyamoya/core/user/profile/AgeType.kt +++ b/src/main/kotlin/com/ohayo/moyamoya/core/user/profile/AgeType.kt @@ -3,8 +3,15 @@ package com.ohayo.moyamoya.core.user.profile enum class AgeType { YOUNGER, SAME, - OLDER; + OLDER, + ANY; + + fun score(age: Int, targetAge: Int): Int { + if (this == ANY) return 0 + if (isMatched(age, targetAge)) return 10 + return -10 + } - fun isMatched(age: Int, targetAge: Int) = + private fun isMatched(age: Int, targetAge: Int) = age == targetAge && this == SAME || age > targetAge && this == YOUNGER || age < targetAge && this == OLDER } \ No newline at end of file