Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/kotlin/Lee.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.survivalcoding

class Lee {
}

fun main() {
println("한글")
}
2 changes: 1 addition & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ fun main() {
val yukymController = YukymController()
println(yukymController.getTyA()) // 해당 월에 맞는 자시의 국 표시
println(yukymController.getTyB()) // 해당 시간에 맞는 자시의 국 표시
}
}
22 changes: 11 additions & 11 deletions src/main/kotlin/YukymController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.time.format.DateTimeFormatter

class YukymController {

val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd"))
val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))

lateinit var nowTime: String

Expand Down Expand Up @@ -36,16 +36,16 @@ class YukymController {

val nowTime = LocalDateTime.now()
when {
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
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
Comment on lines +39 to +48
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

시간 범위 누락으로 인한 로직 오류

조건 연산자를 ||에서 &&로 변경한 것은 올바르지만, 시간 범위에 누락된 구간이 있습니다:

  • 2-3시 (02:00-03:59): 처리되지 않음 (line 39는 0-1시, line 40은 4-5시를 처리)
  • 14-15시 (14:00-15:59): 처리되지 않음 (line 44는 12-13시, line 45는 16-17시를 처리)

이 시간대에는 when 블록의 어떤 조건도 만족하지 않아 ty12를 반환하게 되는데, 이는 의도된 동작이 아닐 가능성이 높습니다.

다음과 같이 수정하는 것을 권장합니다:

     when {
         nowTime.hour >= 0 && nowTime.hour < 2 -> return timeDataOne.first().ty1
+        nowTime.hour >= 2 && nowTime.hour < 4 -> return timeDataOne.first().ty11
         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 >= 14 && nowTime.hour < 16 -> return timeDataOne.first().ty11
         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
     }

참고: 위 수정안에서 ty11을 사용했지만, 실제 비즈니스 로직에 따라 적절한 ty 값을 매핑해야 합니다. 정확한 시간대-값 매핑 규칙을 확인하여 수정해 주시기 바랍니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
nowTime.hour >= 0 && nowTime.hour < 2 -> return timeDataOne.first().ty1
nowTime.hour >= 2 && nowTime.hour < 4 -> return timeDataOne.first().ty11
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 >= 14 && nowTime.hour < 16 -> return timeDataOne.first().ty11
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
🤖 Prompt for AI Agents
In src/main/kotlin/YukymController.kt around lines 39 to 48, the when block
skips the hour ranges 02:00–03:59 and 14:00–15:59 so those hours fall through to
ty12; add explicit conditions covering the missing 2–4 and 14–16 hour windows
and return the correct ty values for those ranges (use the appropriate ty
entries per business requirements, e.g., ty11 or other), and then verify the
when block covers 0..24 without gaps.

}

return result
Expand Down