Skip to content

Commit

Permalink
Merge pull request #36 from Nexters/hotfix/35-forecast-api-update
Browse files Browse the repository at this point in the history
[#35] 기상청 중기예보 API 응답 변경 대응
  • Loading branch information
jun108059 authored Jan 2, 2025
2 parents 350cd02 + d6b7f78 commit a1644dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/kotlin/nexters/weski/batch/ExternalWeatherService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class ExternalWeatherService(

val tmFc = baseDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + baseTime
// 기존 데이터 삭제
dailyWeatherRepository.deleteByDDayGreaterThanEqual(2)
dailyWeatherRepository.deleteByDDayGreaterThanEqual(4)
skiResortRepository.findAll().forEach { resort ->
val detailedAreaCode = resort.detailedAreaCode
val broadAreaCode = resort.broadAreaCode
Expand Down Expand Up @@ -252,7 +252,7 @@ class ExternalWeatherService(
return weatherList
}

for (i in 3..10) {
for (i in 5..10) {
val forecastDate = now.plusDays(i.toLong() - 1)
val dayOfWeek = forecastDate.dayOfWeek.name // 영어 요일명

Expand Down Expand Up @@ -280,7 +280,7 @@ class ExternalWeatherService(

private fun getPrecipitationChance(midLandData: JsonNode, day: Int): Int {
return when (day) {
in 3..7 -> {
in 5..7 -> {
val amChance = midLandData.get("rnSt${day}Am")?.asInt() ?: 0
val pmChance = midLandData.get("rnSt${day}Pm")?.asInt() ?: 0
maxOf(amChance, pmChance)
Expand All @@ -296,7 +296,7 @@ class ExternalWeatherService(

private fun getCondition(midLandData: JsonNode, day: Int): String {
return when (day) {
in 3..7 -> {
in 5..7 -> {
val amCondition = midLandData.get("wf${day}Am")?.asText() ?: ""
val pmCondition = midLandData.get("wf${day}Pm")?.asText() ?: ""
selectWorseCondition(amCondition, pmCondition)
Expand Down

0 comments on commit a1644dc

Please sign in to comment.