fix: 히어로의 지금 값에 초단기실황 반영, 구간 경계 시각의 우산각 '지금 비'

- 히어로가 DB 예보 행을 직접 읽어 실황이 안 들어가던 것 — 지금 시각 행을 관측값으로 덮음. 피드 캐시도 새 시각 실황이 나오는 매시 10분에 끝나게 함
- 낮이 15:20 에 끝나는 날 15:00~15:20 처럼 구간 경계 직전에는 지금 시각 행이 다음 구간 칸에 들어, 화면이 보여 주는 지금 구간의 우산각이 '지금 비'를 놓치던 것 — 우산각의 지금은 화면이 보여 주는 구간 기준으로 정하고 그 줄 문구도 지금 시각 날씨로
This commit is contained in:
skkim committed 2026-11-23 15:43:50 +09:00
1 parent 5ab2381f79
commit 4c24d95991
4 files changed
+61 -8

No files matched your search

+11 -4
View File
@@ -241,23 +241,30 @@ def slot_results(
hours_by_slot = slot_hours(day, sunset_at)
hours_by_slot[EARLY] = set(range(NIGHT_END_HOUR))
cur = _trim_passed(hours_by_slot, day, sunset_at, now) if now else None
# 화면이 지금 구간으로 보여 주는 칸. 구간 경계 직전(예: 낮이 15:20 에 끝나는데 15시 행은 저녁 칸)에는 cur 와 다를 수 있다
shown = current_slot(now, sunset_at) if now else None
now_hour = int((now - kst_midnight(day)).total_seconds() // 3600) if now else None
activity = [{h % 24 for h in w} for w in window_hours(defn, day, region)]
rest_of_day = defn.factor_rules["rain"].get("span") == "rest_of_day"
out = {}
for key, hours in hours_by_slot.items():
if not hours:
continue
matches = any(any(h % 24 in w for h in hours) for w in activity)
# 시간대 일치 여부와 날씨 평가를 분리해 하루 점수로 대체하지 않는다.
# 우산각은 구간이 아니라 그 구간 시작(지금 구간은 지금)부터 자정까지의 비를 본다.
seen = set(range(min(hours), 24)) if defn.factor_rules["rain"].get("span") == "rest_of_day" else hours
# 우산각은 구간이 아니라 그 구간 시작(화면이 보여 주는 지금 구간은 지금)부터 자정까지의 비를 본다.
if rest_of_day:
seen = set(range(now_hour if key == shown else min(hours), 24))
else:
seen = hours
window = SimpleNamespace(windows=[{"from": min(seen), "to": max(seen) + 1}])
windows = windows_for(window, day, region, by_at, by_om, only=seen)
# 지금 시각의 예보 행이 있을 때만 '지금'이다 (없으면 첫 행은 더 뒤 시각이다)
at_now = key == cur and bool(windows and windows[0]) and windows[0][0].hour == int((now - kst_midnight(day)).total_seconds() // 3600)
at_now = key == shown and bool(windows and windows[0]) and windows[0][0].hour == now_hour
result = evaluate(defn, windows, replace(ctx, time_matches=matches, at_now=at_now))
if result is not None:
# 지금 구간 줄은 남은 시간의 가운데가 아니라 지금 시각 날씨로
if key == cur and windows and windows[0]:
if (key == cur or (rest_of_day and key == shown)) and windows and windows[0]:
result.summary = summary_line(windows[0][0])
out[key] = result
return out