Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhello0507 committed Jan 27, 2025
1 parent 34a3064 commit 4c898ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/com/ohayo/moyamoya/core/user/profile/AgeType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 4c898ee

Please sign in to comment.