From c5c735aa0e0e9bd88419a015bbe3a0c3936ffc14 Mon Sep 17 00:00:00 2001 From: Neouul Date: Fri, 14 Nov 2025 18:48:28 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Debugging:=20=EB=94=94=EB=B2=84=EA=B1=B0?= =?UTF-8?q?=EB=A5=BC=20=ED=86=B5=ED=95=B4=20=EB=AC=B8=EC=A0=9C=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/kotlinc.xml | 2 +- .idea/misc.xml | 2 +- build.gradle.kts | 4 ++-- src/main/kotlin/YukymController.kt | 6 ++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index c224ad5..03fcfb7 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index cb276b8..2a2f9e6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7dbaad0..a143c3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "2.0.21" + kotlin("jvm") version "2.2.0" } group = "com.survivalcoding" @@ -17,5 +17,5 @@ tasks.test { useJUnitPlatform() } kotlin { - jvmToolchain(17) + jvmToolchain(21) } \ No newline at end of file diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index cd4bba7..269838d 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -10,11 +10,14 @@ class YukymController { lateinit var nowTime: String fun getTyA(): String { + // nowDate의 mm 값이 이상함 val timeDataOne = _getTimeDataOne(nowDate) if (timeDataOne.isNotEmpty()) { + // nowTime은 무조건 "갑자1국" nowTime = timeDataOne.first().ty1 + // nowDate의 month값이 이상해서 항상 else로 처리됨 => "갑자1국"이 리턴됨 val month = nowDate.substring(5, 7) return when (month) { "01", "02" -> "경오1국" @@ -36,6 +39,7 @@ class YukymController { val nowTime = LocalDateTime.now() when { + // 시간은 항상 0보다 크거나 같으므로 항상 "갑자1국"이 반환됨 nowTime.hour >= 0 || nowTime.hour < 2 -> return timeDataOne.first().ty1 nowTime.hour >= 4 || nowTime.hour < 6 -> return timeDataOne.first().ty2 nowTime.hour >= 6 || nowTime.hour < 8 -> return timeDataOne.first().ty3 @@ -51,6 +55,8 @@ class YukymController { return result } + // 인자인 nowDate 값을 사용하지 않음 + // timeDataOne 리스트에 YukymTimeModel의 인스턴스를 25개 넣어서 리턴 private fun _getTimeDataOne(nowDate: String): List { val timeDataOne = mutableListOf() for (i in 0..24) { From 4e5f2369a77613eff4f9a3c965c24ba437a8259d Mon Sep 17 00:00:00 2001 From: Neouul Date: Fri, 14 Nov 2025 18:57:31 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Fix:=20getTyB=EC=97=90=EC=84=9C=20=ED=95=AD?= =?UTF-8?q?=EC=83=81=20=EA=B0=91=EC=9E=901=EA=B5=AD=20=EB=A6=AC=ED=84=B4?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/YukymController.kt | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index 269838d..45196e8 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -5,12 +5,12 @@ import java.time.format.DateTimeFormatter class YukymController { + // nowDate의 mm 값이 이상함 val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd")) lateinit var nowTime: String fun getTyA(): String { - // nowDate의 mm 값이 이상함 val timeDataOne = _getTimeDataOne(nowDate) if (timeDataOne.isNotEmpty()) { @@ -38,21 +38,23 @@ class YukymController { var result = timeDataOne.first().ty12 val nowTime = LocalDateTime.now() - when { + return when (nowTime.hour) { // 시간은 항상 0보다 크거나 같으므로 항상 "갑자1국"이 반환됨 - nowTime.hour >= 0 || nowTime.hour < 2 -> return timeDataOne.first().ty1 - nowTime.hour >= 4 || nowTime.hour < 6 -> return timeDataOne.first().ty2 - nowTime.hour >= 6 || nowTime.hour < 8 -> return timeDataOne.first().ty3 - nowTime.hour >= 8 || nowTime.hour < 10 -> return timeDataOne.first().ty4 - nowTime.hour >= 10 || nowTime.hour < 12 -> return timeDataOne.first().ty5 - nowTime.hour >= 12 || nowTime.hour < 14 -> return timeDataOne.first().ty6 - nowTime.hour >= 16 || nowTime.hour < 18 -> return timeDataOne.first().ty7 - nowTime.hour >= 18 || nowTime.hour < 20 -> return timeDataOne.first().ty8 - nowTime.hour >= 20 || nowTime.hour < 22 -> return timeDataOne.first().ty9 - nowTime.hour >= 22 || nowTime.hour < 24 -> return timeDataOne.first().ty10 + // 2~4, 14~16 시간대가 빠져있음 + in 0 until 2 -> timeDataOne.first().ty1 + in 2 until 4 -> timeDataOne.first().ty2 + in 4 until 6 -> timeDataOne.first().ty3 + in 6 until 8 -> timeDataOne.first().ty4 + in 8 until 10 -> timeDataOne.first().ty5 + in 10 until 12 -> timeDataOne.first().ty6 + in 12 until 14 -> timeDataOne.first().ty7 + in 14 until 16 -> timeDataOne.first().ty8 + in 16 until 18 -> timeDataOne.first().ty9 + in 18 until 20 -> timeDataOne.first().ty10 + in 20 until 22 -> timeDataOne.first().ty11 + in 22 until 24 -> timeDataOne.first().ty12 + else -> result } - - return result } // 인자인 nowDate 값을 사용하지 않음 From 9ce42f98f4c052e8adb0c76e4f239620a900f89a Mon Sep 17 00:00:00 2001 From: Neouul Date: Fri, 14 Nov 2025 19:04:07 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20getTyA=EC=97=90=EC=84=9C=20=ED=95=AD?= =?UTF-8?q?=EC=83=81=20=EA=B0=91=EC=9E=901=EA=B5=AD=20=EB=A6=AC=ED=84=B4?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/YukymController.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index 45196e8..01e2da3 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -6,7 +6,9 @@ import java.time.format.DateTimeFormatter class YukymController { // nowDate의 mm 값이 이상함 - val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd")) + // ISO 8601 표준 yyyy-MM-dd'T'HH:mm:ss + // 즉, MM이 아닌 mm을 써서 분이 입력된 것 + val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) lateinit var nowTime: String From 864cb888887ddb6d714d67fabe7061a12c6aaa9b Mon Sep 17 00:00:00 2001 From: Neouul Date: Fri, 14 Nov 2025 19:09:15 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Refactor:=20=EC=A1=B0=EA=B8=88=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/YukymController.kt | 70 ++++++++++++++---------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index 01e2da3..f47a1b6 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -13,60 +13,56 @@ class YukymController { lateinit var nowTime: String fun getTyA(): String { - val timeDataOne = _getTimeDataOne(nowDate) + val timeDataOne = _getTimeDataOne() - if (timeDataOne.isNotEmpty()) { - // nowTime은 무조건 "갑자1국" - nowTime = timeDataOne.first().ty1 + nowTime = timeDataOne.ty1 - // nowDate의 month값이 이상해서 항상 else로 처리됨 => "갑자1국"이 리턴됨 - val month = nowDate.substring(5, 7) - return when (month) { - "01", "02" -> "경오1국" - "03", "04" -> "경오2국" - "05", "06" -> "경오3국" - "07", "08" -> "경오4국" - "09", "10" -> "경오5국" - "11", "12" -> "경오6국" - else -> nowTime - } - } else { - return "경오7국" + // nowDate의 month값이 이상해서 항상 else로 처리됨 => "갑자1국"이 리턴됨 + val month = nowDate.substring(5, 7) + return when (month) { + "01", "02" -> "경오1국" + "03", "04" -> "경오2국" + "05", "06" -> "경오3국" + "07", "08" -> "경오4국" + "09", "10" -> "경오5국" + "11", "12" -> "경오6국" + else -> nowTime } } fun getTyB(): String { - val timeDataOne = _getTimeDataOne(nowDate) - var result = timeDataOne.first().ty12 + val timeDataOne = _getTimeDataOne() + val result = timeDataOne.ty12 val nowTime = LocalDateTime.now() return when (nowTime.hour) { // 시간은 항상 0보다 크거나 같으므로 항상 "갑자1국"이 반환됨 // 2~4, 14~16 시간대가 빠져있음 - in 0 until 2 -> timeDataOne.first().ty1 - in 2 until 4 -> timeDataOne.first().ty2 - in 4 until 6 -> timeDataOne.first().ty3 - in 6 until 8 -> timeDataOne.first().ty4 - in 8 until 10 -> timeDataOne.first().ty5 - in 10 until 12 -> timeDataOne.first().ty6 - in 12 until 14 -> timeDataOne.first().ty7 - in 14 until 16 -> timeDataOne.first().ty8 - in 16 until 18 -> timeDataOne.first().ty9 - in 18 until 20 -> timeDataOne.first().ty10 - in 20 until 22 -> timeDataOne.first().ty11 - in 22 until 24 -> timeDataOne.first().ty12 + in 0 until 2 -> timeDataOne.ty1 + in 2 until 4 -> timeDataOne.ty2 + in 4 until 6 -> timeDataOne.ty3 + in 6 until 8 -> timeDataOne.ty4 + in 8 until 10 -> timeDataOne.ty5 + in 10 until 12 -> timeDataOne.ty6 + in 12 until 14 -> timeDataOne.ty7 + in 14 until 16 -> timeDataOne.ty8 + in 16 until 18 -> timeDataOne.ty9 + in 18 until 20 -> timeDataOne.ty10 + in 20 until 22 -> timeDataOne.ty11 + in 22 until 24 -> timeDataOne.ty12 else -> result } } // 인자인 nowDate 값을 사용하지 않음 // timeDataOne 리스트에 YukymTimeModel의 인스턴스를 25개 넣어서 리턴 - private fun _getTimeDataOne(nowDate: String): List { - val timeDataOne = mutableListOf() - for (i in 0..24) { - timeDataOne.add(YukymTimeModel()) - } - return timeDataOne + private fun _getTimeDataOne(): YukymTimeModel { +// val timeDataOne = mutableListOf() +// for (i in 0..24) { +// timeDataOne.add(YukymTimeModel()) +// } + + return YukymTimeModel() } }