From 62053135d2705d69bb2d9410a6b0d1496792691e Mon Sep 17 00:00:00 2001 From: hhhello Date: Thu, 10 Oct 2024 09:17:20 +0900 Subject: [PATCH] Fix to update UserEntity --- .../graduating/graduatingserver/core/user/UserEntity.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Graduating-Server/src/main/kotlin/com/bestswlkh0310/graduating/graduatingserver/core/user/UserEntity.kt b/Graduating-Server/src/main/kotlin/com/bestswlkh0310/graduating/graduatingserver/core/user/UserEntity.kt index abcb92e..163edfc 100644 --- a/Graduating-Server/src/main/kotlin/com/bestswlkh0310/graduating/graduatingserver/core/user/UserEntity.kt +++ b/Graduating-Server/src/main/kotlin/com/bestswlkh0310/graduating/graduatingserver/core/user/UserEntity.kt @@ -71,11 +71,9 @@ class UserEntity( if (nickname != null) { this.nickname = nickname } - if (graduatingYear != null) { - this.school?.type?.let { type -> - val currentYear = LocalDateTime.now().year - this.graduatingYear = graduatingYear.coerceIn(currentYear + 1, currentYear + type.limit) - } + if (graduatingYear != null && school?.type != null) { + val currentYear = LocalDateTime.now().year + this.graduatingYear = graduatingYear.coerceIn(currentYear + 1, currentYear + school.type.limit) } if (school != null) { this.school = school