feat: 피드에 자외선 포스트 (아침·낮, 오늘 가장 셀 때 '보통' 이상인 날만)

- 오늘 9·12·15·18시 자외선(Open-Meteo)과 가장 셀 때 시각, '높음' 이상이면 할 일 한 줄
- '낮음'인 날은 챙길 게 없어 띄우지 않음
This commit is contained in:
minaChoi committed 2026-10-07 16:51:57 +09:00
1 parent c67121351b
commit 35b3e0df43
6 files changed
+90 -10

No files matched your search

+15
View File
@@ -349,3 +349,18 @@ def test_gak_caption_starts_with_score_band_sentence():
assert _gak_caption(item) == "딱 좋아요! 하기 좋은 때는 18~24시예요."
item.definition.sentences = {}
assert _gak_caption(item) == "하기 좋은 때는 18~24시예요."
def test_uv_post_only_when_moderate_or_higher():
from datetime import datetime
from types import SimpleNamespace
from common.utils.kma_time import KST
from services.feed_service import FeedService
at = lambda h: datetime(2026, 10, 7, h, tzinfo=KST) # noqa: E731
base = dict(post_id=1, post_type=PostType.UV, like_count=0, comment_count=0, published_at=at(9))
ctx = lambda vals: SimpleNamespace(region=SimpleNamespace(short_name="분당구"), uv=[SimpleNamespace(forecast_at=at(h), uv_index=v) for h, v in vals]) # noqa: E731
post = FeedService._uv_post(None, base, ctx([(9, 2.0), (12, 6.4), (15, 4.0)]))
assert post.title == "자외선 높음" and post.caption == "가장 셀 때 낮 12시 · 6" and post.slides[0].rows[-1].label == "이렇게 해요"
assert FeedService._uv_post(None, base, ctx([(9, 1.0), (12, 2.5)])) is None
assert FeedService._uv_post(None, base, ctx([])) is None