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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ bin/
.vscode/

### Mac OS ###
.DS_Store
.DS_Store
.idea
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "2.0.21"
kotlin("jvm") version "2.2.0"
}

group = "com.survivalcoding"
Expand All @@ -17,5 +17,5 @@ tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
jvmToolchain(21)
}
23 changes: 12 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,17 @@ 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 +40 to +49
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시~4시 (ty1과 ty2 사이)
  • 14시~16시 (ty6과 ty7 사이)

이로 인해 해당 시간대에는 when 문이 아무 조건에도 매칭되지 않아 line 52의 result(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
     }
📝 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
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
🤖 Prompt for AI Agents
In src/main/kotlin/YukymController.kt around lines 40 to 49, the when branches
skip the 2:00–3:59 and 14:00–15:59 ranges which leaves those hours unmatched and
falls back to the default result; add explicit when branches for nowTime.hour >=
2 && nowTime.hour < 4 and nowTime.hour >= 14 && nowTime.hour < 16 that return
the appropriate timeDataOne.first().tyX values (ensure you pick the correct ty
field consistent with the surrounding mapping so ranges do not overlap), and run
a quick sanity check to confirm every hour 0–23 is covered.

}

return result
Expand Down