refactor(weather): add wind object to WeatherValue model

This commit is contained in:
2026-09-15 18:00:22 +03:00
parent 91a1e4498c
commit d47dcf69e6
10 changed files with 83 additions and 94 deletions
+4 -3
View File
@@ -3,6 +3,7 @@ import datetime
from gallery.sketch.weather.model import Cloudness, Precipitation, WeatherValue
from gallery.sketch.weather.util import build_weather_value
from ...sketch.weather.parser import parse_wind_direction
from .openweather import ForecastItem
@@ -31,9 +32,9 @@ class ForecastItemParser:
# value.temperature = [round(item.main.temp_max), round(item.main.temp_min)]
value.pressure = [round(item.main.pressure * 0.75006)]
value.humidity = item.main.humidity
value.wind_speed = round(item.wind.speed)
value.wind_gust = round(item.wind.gust)
value.wind_direction = item.wind.deg
value.wind.speed = round(item.wind.speed)
value.wind.gust = round(item.wind.gust)
value.wind.direction = parse_wind_direction(item.wind.deg)
value.sky.cloudness = self.CLOUDNESS_MAP.get(item.weather[0].description, Cloudness.CLEAR)
value.sky.precipitation = self.PRECIPITATION_MAP.get(item.weather[0].description, Precipitation.NO)
if item.rain: