fix: 각을 시간대와 관계없이 활성화하고 시간 적합도를 가중치로 반영

This commit is contained in:
skkim committed 2026-10-22 13:38:39 +09:00
1 parent 3b5afba8a1
commit 799a46f53c
13 files changed
+124 -66

No files matched your search

+6 -1
View File
@@ -8,10 +8,12 @@ from common.database.db_session_manager import DB_SESSION_MNG
from common.enums import PostType
from common.utils.kma_time import now_kst
from crud.feed_crud import FeedCRUD
from crud.index_crud import IndexCRUD
from crud.region_crud import RegionCRUD
from crud.season_crud import SeasonCRUD
from router.router import app
from services.feed_service import build_feed_day
from services.index_service import in_season
from services.week_service import collect_events
REGION = "1114000000"
@@ -61,7 +63,10 @@ async def test_feed_assembles_hero_stories_posts_and_bands(offline):
body = (await client.get("/v1/feed", params={"region": REGION})).json()
assert body["result"]["success"] is True
assert body["hero"]["temp_c"] == 20 and body["hero"]["top1"]["rank"] == 1 and "top3" not in body["hero"]
assert len(body["stories"]) == 40
_, definitions = await DB_SESSION_MNG.execute_lambda(lambda s: IndexCRUD().definitions(s))
expected = {d.code for d in definitions if in_season(d, now_kst().month)}
assert {g["code"] for g in body["stories"]} == expected
assert all(g["active"] for g in body["stories"])
assert body["hero"]["weather_score"] == body["hero"]["weather_slots"][body["slot"]]
assert all(g["slots"][body["slot"]] == g["score"] and g["slot_ranks"][body["slot"]] == g["rank"] for g in body["stories"] if g["active"])
weather = next(p for p in body["posts"] if p["post_type"] == PostType.WEATHER.value)