Skip to content
Open
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
26 changes: 15 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 @@ -35,17 +35,21 @@ class YukymController {
var result = timeDataOne.first().ty12

val nowTime = LocalDateTime.now()
val hour = nowTime.hour

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
hour >= 0 && hour < 2 -> return timeDataOne.first().ty1
hour >= 2 && hour < 4 -> return timeDataOne.first().ty2
hour >= 4 && hour < 6 -> return timeDataOne.first().ty3
hour >= 6 && hour < 8 -> return timeDataOne.first().ty4
hour >= 8 && hour < 10 -> return timeDataOne.first().ty5
hour >= 10 && hour < 12 -> return timeDataOne.first().ty6
hour >= 12 && hour < 14 -> return timeDataOne.first().ty7
hour >= 14 && hour < 16 -> return timeDataOne.first().ty8
hour >= 16 && hour < 18 -> return timeDataOne.first().ty9
hour >= 18 && hour < 20 -> return timeDataOne.first().ty10
hour >= 20 && hour < 22 -> return timeDataOne.first().ty11
hour >= 22 && hour < 24 -> return timeDataOne.first().ty12
}

return result
Expand Down