feat: 주말 예보 카드에 토·일 대표 각 3개, 칸을 제목 아래로 올려 가운데 빈 공간 없애기

This commit is contained in:
minaChoi committed 2026-10-12 09:18:01 +09:00
1 parent fcf199031a
commit ef57a47e29
6 files changed
+63 -6

No files matched your search

+10 -2
View File
@@ -21,7 +21,7 @@ from crud.season_crud import SeasonCRUD
from crud.weather_crud import WeatherCRUD
from router.v1.feed.protocol import (
BandArticle, BandEvent, Bands, Cut, GakSlide, Hero, HeroStat, HourCell, HoursSlide, PostData, Res_Feed, Row, RowsSlide, SunsetSlide,
PlanSlide, PlanStep, TopIndex, WeekDay, WeekSlide,
PlanSlide, PlanStep, TopIndex, WeekDay, WeekGak, WeekSlide,
)
from services.air_service import GRADE_LABEL as AIR_GRADE_LABEL
from services.air_service import pm10_grade, pm25_grade
@@ -496,7 +496,8 @@ class FeedService:
for label, w in zip(("이번 주말", "다음 주말"), weekends):
f = forecast(w)
slides.append(WeekSlide(kind="week", eyebrow=f"{label} · {day_range(w[0].day, w[-1].day)}", line=f.line, tip=f.tip, days=[
WeekDay(day=d.day, weekday=d.weekday, icon=d.icon, text=d.headline, temp_min_c=d.temp_min_c, temp_max_c=d.temp_max_c, rain_prob=d.rain_prob)
WeekDay(day=d.day, weekday=d.weekday, icon=d.icon, text=d.headline, temp_min_c=d.temp_min_c, temp_max_c=d.temp_max_c, rain_prob=d.rain_prob,
gaks=_day_gaks(c.board, d.day))
for d in w
]))
first = forecast(weekends[0])
@@ -754,6 +755,13 @@ def _event_caption(e: EventItem) -> str:
_CLOUDY = {Sky.CLEAR: 0.0, Sky.PARTLY: 0.5, Sky.CLOUDY: 1.0}
def _day_gaks(board: Optional[IndexBoard], day: date, n: int = 3) -> list[WeekGak]:
"""그날 대표 각: 각 상세의 날짜별 점수(하루 중 가장 좋은 시간대)를 점수 × 중요도 순으로."""
scored = [(i.definition, s) for i in (board.items if board else []) for s in i.trend if s.score_date == day]
scored.sort(key=lambda x: rank_score(x[1].score, x[0].priority), reverse=True)
return [WeekGak(index_id=d.index_id, name=d.name, icon=d.icon, score=s.score) for d, s in scored[:n]]
def _moon_view(region: Region, now: datetime, hourly: list[WeatherHourly]) -> tuple[MoonNight, str]:
"""오늘 밤 달과 잘 보이는지 한 마디. 구름은 달이 떠 있는 시각의 시간별 예보 하늘로 본다."""
day = feed_day(now.astimezone(KST))