diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt index 76d27d8e..5555329d 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/member/service/ProfessorService.kt @@ -116,7 +116,14 @@ class ProfessorServiceImpl( SimpleProfessorDto.of(it, imageURL) } .sortedWith { a, b -> + when { + enumLanguageType == LanguageType.EN -> { + val lastNameA = a.name.split(" ").last() + val lastNameB = b.name.split(" ").last() + lastNameA.compareTo(lastNameB) + } + startsWithEnglish(a.name) && !startsWithEnglish(b.name) -> 1 !startsWithEnglish(a.name) && startsWithEnglish(b.name) -> -1 else -> a.name.compareTo(b.name) @@ -138,6 +145,12 @@ class ProfessorServiceImpl( } .sortedWith { a, b -> when { + enumLanguageType == LanguageType.EN -> { + val lastNameA = a.name.split(" ").last() + val lastNameB = b.name.split(" ").last() + lastNameA.compareTo(lastNameB) + } + startsWithEnglish(a.name) && !startsWithEnglish(b.name) -> 1 !startsWithEnglish(a.name) && startsWithEnglish(b.name) -> -1 else -> a.name.compareTo(b.name)