-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Nexters/feature/37-enhance-weather-batch-…
…logic [#37] 날씨 업데이트 batch 단기/중기 혼합 로직 수정
- Loading branch information
Showing
5 changed files
with
252 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package nexters.weski.weather | ||
|
||
import java.time.LocalDate | ||
|
||
data class DailyForecast( | ||
val date: LocalDate, | ||
var minTemp: Int = Int.MAX_VALUE, | ||
var maxTemp: Int = Int.MIN_VALUE, | ||
var precipitationChance: Int = 0, | ||
var ptyCode: Int = 0, // PTY: 강수형태 코드 | ||
var skyCode: Int = 1 // SKY: 기본값을 맑음(1)으로 | ||
) { | ||
// 최종 condition 계산 | ||
fun getCondition(): String { | ||
// PTY가 0이 아니면 비/눈/소나기 등 | ||
// PTY 코드 매핑은 상황에 맞게 더 정교화 가능 | ||
if (ptyCode != 0) { | ||
return when (ptyCode) { | ||
1 -> "비" | ||
2 -> "비/눈" | ||
3 -> "눈" | ||
4 -> "소나기" // 단기예보에서 4는 소나기 | ||
else -> "기타강수" | ||
} | ||
} else { | ||
// PTY = 0인 경우 SKY 코드 확인 | ||
return when (skyCode) { | ||
1 -> "맑음" | ||
3 -> "구름많음" | ||
4 -> "흐림" | ||
else -> "맑음" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters