fix: 히어로 상태 한 줄 자외선을 저녁 구간(일몰 2시간 전~)에도 보이게, 밤 구간에만 뺀다

This commit is contained in:
minaChoi committed 2026-10-12 16:24:58 +09:00
1 parent 0b8eb84b55
commit 72301e9f10
4 files changed
+8 -5

No files matched your search

+3 -2
View File
@@ -42,6 +42,7 @@ class HeroInput:
moon: Optional[str] = None
humidity: Optional[int] = None
discomfort: Optional[int] = None
after_dark: bool = False # 밤 구간(일몰 1시간 뒤~). night 는 저녁 구간까지 포함한다
_UV_LABELS = ("낮음", "보통", "높음", "매우 높음", "위험")
@@ -65,13 +66,13 @@ def humidity_label(h: int) -> str:
def hero_status(x: HeroInput) -> list[HeroStatItem]:
"""히어로 상태 한 줄: 습도·불쾌지수·자외선(낮에만)·미세먼지를 단계 이름으로. 값이 없는 칸은 뺀다. 조심할 것만 warn."""
"""히어로 상태 한 줄: 습도·불쾌지수·자외선(해 있을 때, 저녁 포함)·미세먼지를 단계 이름으로. 값이 없는 칸은 뺀다. 조심할 것만 warn."""
out: list[HeroStatItem] = []
if x.humidity is not None:
out.append(HeroStatItem("humidity", "muggy", "습도", humidity_label(x.humidity)))
if x.discomfort is not None:
out.append(HeroStatItem("discomfort", "muggy", "불쾌지수", discomfort_label(x.discomfort), "warn" if x.discomfort >= MUGGY_DI else "normal"))
if not x.night and x.uv is not None:
if not x.after_dark and x.uv is not None:
out.append(HeroStatItem("uv", "glasses", "자외선", uv_label(x.uv), "warn" if x.uv >= UV_HIGH else "normal"))
if x.air is not None:
out.append(HeroStatItem("air", "mask", "미세먼지", GRADE_LABEL[x.air], "warn" if x.air in (AirGrade.BAD, AirGrade.VERY_BAD) else "normal"))