feat: 새 각 4개 추가 (야구·공부·넷플릭스·군밤)

This commit is contained in:
minaChoi committed 2026-10-06 10:02:55 +09:00
1 parent 14ddebd040
commit d764d0e9ed
11 files changed
+217 -6

No files matched your search

+200
View File
@@ -1282,5 +1282,205 @@
"limit_description": "장소 혼잡도는 반영하지 못해요",
"sentences": {},
"sort_order": 23
},
{
"code": "baseball",
"name": "야구각",
"icon": "baseball",
"category": 1,
"is_fun": true,
"is_core": false,
"has_detail": true,
"description": "저녁 6~10시, 야구장 직관하기 좋은 정도",
"windows": [
{
"from": 18,
"to": 22
}
],
"weight_temp": 25,
"weight_rain": 40,
"weight_wind": 10,
"weight_humidity": 5,
"weight_air": 10,
"weight_time": 10,
"factor_rules": {
"temp": {
"type": "range",
"lo": 15,
"hi": 25
},
"rain": {
"dir": "dry"
},
"wind": {
"type": "calm",
"ok": 3,
"limit": 10
},
"humidity": {
"type": "range",
"lo": 40,
"hi": 60
},
"time": {
"type": "weekday",
"mon": 10,
"default": 100
}
},
"zero_rules": [
{
"field": "rain_prob",
"op": ">=",
"value": 70
}
],
"limit_description": "경기 일정과 시즌(3~10월)은 반영하지 못해요",
"sentences": {},
"sort_order": 24
},
{
"code": "study",
"name": "공부각",
"icon": "study",
"category": 3,
"is_fun": true,
"is_core": false,
"has_detail": true,
"description": "오후 1~6시, 밖에 나가기 싫어서 공부가 잘되는 정도",
"windows": [
{
"from": 13,
"to": 18
}
],
"weight_temp": 35,
"weight_rain": 35,
"weight_wind": 10,
"weight_humidity": 5,
"weight_air": 5,
"weight_time": 10,
"factor_rules": {
"temp": {
"type": "away",
"lo": 15,
"hi": 24
},
"rain": {
"dir": "wet"
},
"wind": {
"type": "strong"
},
"humidity": {
"type": "higher"
},
"time": {
"type": "weekday",
"sat": 50,
"sun": 50,
"holiday": 50,
"default": 100
}
},
"zero_rules": [],
"limit_description": "사람마다 달라서 재미로 봐 주세요",
"sentences": {},
"sort_order": 25
},
{
"code": "netflix",
"name": "넷플릭스각",
"icon": "netflix",
"category": 3,
"is_fun": true,
"is_core": false,
"has_detail": true,
"description": "밤 8시~자정, 집에서 영화 보기 좋은 정도",
"windows": [
{
"from": 20,
"to": 24
}
],
"weight_temp": 30,
"weight_rain": 35,
"weight_wind": 15,
"weight_humidity": 5,
"weight_air": 0,
"weight_time": 15,
"factor_rules": {
"temp": {
"type": "lower",
"zero": 22,
"full": 0
},
"rain": {
"dir": "wet"
},
"wind": {
"type": "strong"
},
"humidity": {
"type": "ignore"
},
"time": {
"type": "weekday",
"fri": 100,
"sat": 100,
"default": 60
}
},
"zero_rules": [],
"limit_description": "재미로 보는 지수예요",
"sentences": {},
"sort_order": 26
},
{
"code": "chestnut",
"name": "군밤각",
"icon": "chestnut",
"category": 2,
"is_fun": true,
"is_core": false,
"has_detail": true,
"description": "저녁 5~9시, 길거리 군밤이 당기는 정도",
"windows": [
{
"from": 17,
"to": 21
}
],
"weight_temp": 55,
"weight_rain": 25,
"weight_wind": 10,
"weight_humidity": 0,
"weight_air": 5,
"weight_time": 5,
"factor_rules": {
"temp": {
"type": "lower",
"zero": 18,
"full": 0
},
"rain": {
"dir": "dry"
},
"wind": {
"type": "strong"
},
"humidity": {
"type": "ignore"
},
"time": {
"type": "fixed",
"value": 100
}
},
"zero_rules": [],
"limit_description": "군밤 노점이 있는지는 반영하지 못해요",
"sentences": {},
"sort_order": 27
}
]
+4
View File
@@ -70,6 +70,10 @@ def temp_score(rule: dict, feels: float) -> tuple[int, str]:
if rule["type"] == "range":
lo, hi = rule["lo"], rule["hi"]
return _peak(t, lo, hi, rule.get("best"), 8), f"{shown}, 편한 범위 {lo}~{hi}° {'안' if lo <= t <= hi else '밖'}"
if rule["type"] == "away":
lo, hi = rule["lo"], rule["hi"]
dist = 0 if lo <= t <= hi else min(abs(t - lo), abs(t - hi))
return _clamp(30 + 7 * dist), f"{shown}, 편한 범위 {lo}~{hi}°에서 멀수록 올라가요"
return _linear(t, rule["zero"], rule["full"]), shown
+1 -1
View File
@@ -43,7 +43,7 @@ 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"]) == 23
assert len(body["stories"]) == 27
weather = next(p for p in body["posts"] if p["post_type"] == PostType.WEATHER.value)
assert [s["kind"] for s in weather["slides"]] == ["hours", "rows"]
assert len(weather["slides"][0]["hours"]) == 8
+2 -2
View File
@@ -39,11 +39,11 @@ def fakes(monkeypatch):
@pytest.mark.anyio
async def test_index_list_ranks_all_23_with_3_day_trend(fakes):
async def test_index_list_ranks_all_27_with_3_day_trend(fakes):
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
body = (await client.get("/v1/index/list", params={"region": REGION})).json()
assert body["result"]["success"] is True
assert len(body["items"]) == 23 and len(body["top3"]) == 3
assert len(body["items"]) == 27 and len(body["top3"]) == 3
scores = [i["score"] for i in body["items"]]
assert scores == sorted(scores, reverse=True)
assert all(len(i["trend"]) == 3 for i in body["items"])
+7
View File
@@ -47,6 +47,13 @@ def test_temp_peaks_at_best_and_loses_8_per_degree_outside():
assert temp_score({"type": "range", "lo": 10, "hi": 20, "offset": -6}, 21)[1].startswith("정상 15°")
def test_temp_away_rises_outside_comfort():
rule = {"type": "away", "lo": 15, "hi": 24}
assert temp_score(rule, 20)[0] == 30
assert temp_score(rule, 34)[0] == 100
assert temp_score(rule, 5)[0] == 100
def test_rain_dry_and_wet():
assert rain_score({"dir": "dry"}, 30, False)[0] == 70
assert rain_score({"dir": "dry"}, 30, True)[0] == 0