diff options
Diffstat (limited to 'android-app/app')
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/data/model/WeatherResponse.kt | 6 | ||||
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/android-app/app/src/main/kotlin/org/terst/nav/data/model/WeatherResponse.kt b/android-app/app/src/main/kotlin/org/terst/nav/data/model/WeatherResponse.kt index 784f17a..46091ae 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/data/model/WeatherResponse.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/data/model/WeatherResponse.kt @@ -15,7 +15,7 @@ data class WeatherHourly( @Json(name = "time") val time: List<String>, @Json(name = "windspeed_10m") val windspeed10m: List<Double>, @Json(name = "winddirection_10m") val winddirection10m: List<Double>, - @Json(name = "temperature_2m") val temperature2m: List<Double>, - @Json(name = "precipitation_probability") val precipitationProbability: List<Int>, - @Json(name = "weathercode") val weathercode: List<Int> + @Json(name = "temperature_2m") val temperature2m: List<Double>? = null, + @Json(name = "precipitation_probability") val precipitationProbability: List<Int>? = null, + @Json(name = "weathercode") val weathercode: List<Int>? = null ) diff --git a/android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt b/android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt index a716051..62549ad 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt @@ -27,9 +27,9 @@ class WeatherRepository( timeIso = h.time[i], windKt = h.windspeed10m[i], windDirDeg = h.winddirection10m[i], - tempC = h.temperature2m[i], - precipProbabilityPct = h.precipitationProbability[i], - weatherCode = h.weathercode[i] + tempC = h.temperature2m?.get(i) ?: 0.0, + precipProbabilityPct = h.precipitationProbability?.get(i) ?: 0, + weatherCode = h.weathercode?.get(i) ?: 0 ) } }.also { result -> @@ -75,7 +75,7 @@ class WeatherRepository( MarineConditions( windSpeedKt = w.windspeed10m.firstOrNull(), windDirDeg = w.winddirection10m.firstOrNull(), - tempC = w.temperature2m.firstOrNull(), + tempC = w.temperature2m?.firstOrNull(), waveHeightM = m.waveHeight.firstOrNull(), waveDirDeg = m.waveDirection.firstOrNull(), swellHeightM = m.swellWaveHeight.firstOrNull(), |
