fix(weather): optional pressure and humidity in weather value
This commit is contained in:
@@ -173,7 +173,7 @@
|
|||||||
{% for value in response.values %}
|
{% for value in response.values %}
|
||||||
<td class="humidity"
|
<td class="humidity"
|
||||||
style="background-color: rgba(128, 128, 255, {{value.humidity * 0.005}});">
|
style="background-color: rgba(128, 128, 255, {{value.humidity * 0.005}});">
|
||||||
<span class="value">{{value.humidity}}</span>
|
{% if value.humidity > -1%}<span class="value">{{value.humidity}}</span>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import datetime
|
|||||||
from enum import StrEnum, auto
|
from enum import StrEnum, auto
|
||||||
from typing import Self
|
from typing import Self
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
class Model(BaseModel):
|
class Model(BaseModel):
|
||||||
@@ -116,8 +116,8 @@ class WeatherValue(Model):
|
|||||||
wind_gust: int
|
wind_gust: int
|
||||||
wind_direction: float
|
wind_direction: float
|
||||||
precipitation: float
|
precipitation: float
|
||||||
pressure: list[int]
|
pressure: list[int] = Field(default=[])
|
||||||
humidity: int
|
humidity: int = Field(default=-1)
|
||||||
|
|
||||||
|
|
||||||
class WeatherResponse(Model):
|
class WeatherResponse(Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user