feat: 히어로 칸을 지금·습도·불쾌지수·상황 1칸으로 — 습도·불쾌지수 늘 표시

This commit is contained in:
minaChoi committed 2026-10-08 17:20:06 +09:00
1 parent 97ebfe2d36
commit 3a73a44cb0
7 files changed
+31 -23

No files matched your search

+2 -1
View File
@@ -144,7 +144,7 @@ def _hero_input(now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: O
rain_later_at=later, today_known=bool(ahead),
air=AirGrade(now_w.air.grade) if now_w and now_w.air and now_w.air.grade is not None else None, uv=uv,
temp_min=min(temps, default=None), temp_max=max(temps, default=None),
temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None, discomfort=cur.discomfort_index if cur else None,
temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None,
moon=phase_name(_tonight(now)),
)
@@ -430,6 +430,7 @@ class FeedService:
return Hero(
now_at=now, sky_mode=_SKY_MODE[slot],
temp_c=float(cur.temp_c) if cur else None, feels_c=float(cur.feels_c) if cur else None,
humidity=cur.humidity if cur else None,
discomfort=cur.discomfort_index if cur else None, discomfort_label=_discomfort_label(cur.discomfort_index) if cur else None,
rain_2h_text=now_w.rain_2h_text if now_w else None, will_rain_2h=now_w.will_rain_2h if now_w else None,
weather_score=board.weather_score if board else None, top1=_top(top) if top else None, bubble=bubble,
+2 -10
View File
@@ -12,8 +12,7 @@ Tone = Literal["normal", "warn", "rain"]
UV_HIGH = 6.0
TEMP_SWING_C = 10.0
WIND_CHILL_C = 3.0
MUGGY = 75
SHOWN = 2
SHOWN = 1
@dataclass(frozen=True)
@@ -38,7 +37,6 @@ class HeroInput:
temp_max: Optional[float] = None
temp: Optional[float] = None
feels: Optional[float] = None
discomfort: Optional[int] = None
moon: Optional[str] = None
@@ -46,16 +44,12 @@ def uv_label(uv: float) -> str:
return "낮음" if uv < 3 else "보통" if uv < 6 else "높음" if uv < 8 else "매우 높음" if uv < 11 else "위험"
def _discomfort_label(v: int) -> str:
return "보통" if v < 75 else "높음" if v < 80 else "매우 높음"
def _rain_value(now: datetime, at: datetime) -> str:
return "지금 와요" if at <= now else f"{hour_label(at.astimezone(KST).hour)}쯤 와요"
def hero_stats(x: HeroInput) -> list[HeroStatItem]:
"""히어로 두 칸. 지금 챙겨야 할 것(경고)을 먼저, 모자라면 기본값으로 채운다."""
"""히어로 상황 칸 (습도·불쾌지수는 늘 따로 보인다). 지금 챙겨야 할 것(경고)을 먼저, 모자라면 기본값으로 채운다."""
alerts: list[HeroStatItem] = []
if x.rain_at is not None:
alerts.append(HeroStatItem("rain", "umbrella", "지금 비", _rain_value(x.now, x.rain_at), "rain"))
@@ -69,8 +63,6 @@ def hero_stats(x: HeroInput) -> list[HeroStatItem]:
alerts.append(HeroStatItem("swing", "coldwind", f"일교차 {round(x.temp_max - x.temp_min)}°", "아침엔 겉옷"))
if x.temp is not None and x.feels is not None and x.temp - x.feels >= WIND_CHILL_C:
alerts.append(HeroStatItem("chill", "coldwind", f"체감 {round(x.feels)}°", "바람 쌀쌀"))
if x.discomfort is not None and x.discomfort >= MUGGY:
alerts.append(HeroStatItem("muggy", "muggy", "불쾌지수", f"{x.discomfort} · {_discomfort_label(x.discomfort)}", "warn"))
# 챙길 게 없을 땐 하루 기준 비 소식과 밤의 달만. '미세먼지 좋음'·'자외선 낮음' 같은 값으로 칸을 채우지 않는다
fills: list[HeroStatItem] = []