From e059e294d03d0d76a88e4fa3cfb41a84987a38d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?=
Date: Thu, 8 Oct 2026 10:57:11 +0900
Subject: [PATCH 01/30] =?UTF-8?q?feat:=20=EB=82=AE=20=EC=95=BC=EC=99=B8=20?=
=?UTF-8?q?=ED=99=9C=EB=8F=99=20=EC=A7=80=EC=88=98=EC=97=90=20=ED=96=87?=
=?UTF-8?q?=EB=B9=9B=C2=B7=EC=9E=90=EC=99=B8=EC=84=A0=20=EA=B0=99=EC=9D=80?=
=?UTF-8?q?=20=EB=B9=84=EC=A4=91=EC=9C=BC=EB=A1=9C,=20=EB=9F=AC=EB=8B=9D?=
=?UTF-8?q?=C2=B7=EB=A9=8D=EB=AD=89=EC=82=B0=EC=B1=85=EC=9D=80=20=EC=9E=90?=
=?UTF-8?q?=EC=99=B8=EC=84=A0=20=EC=A0=9C=EC=99=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/docs/openmeteo-data.md | 16 +++---
backend/seed/index_definition.json | 86 ++++++++++++++++++------------
2 files changed, 62 insertions(+), 40 deletions(-)
diff --git a/backend/docs/openmeteo-data.md b/backend/docs/openmeteo-data.md
index 30eab53..c128c29 100644
--- a/backend/docs/openmeteo-data.md
+++ b/backend/docs/openmeteo-data.md
@@ -140,17 +140,19 @@ light = 1 - min(low100 + 0.5×mid100, 100) / 100
| 지수 | 새 비중 | 바뀐 기존 비중 (기온·비·바람·습도·공기) | 추가 0점 조건 |
|---|---|---|---|
| 빨래각 | 햇빛 25 | 15·30·15·10·0 | |
-| 멍뭉산책각 | 자외선 5 | 35·25·10·5·15 | 지표면 온도 45° 이상 |
-| 피크닉각 | 자외선 10 | 25·25·15·5·10 | |
-| 등산각 | 자외선 5, 가시거리 5 | 25·25·20·5·10 | |
-| 러닝각 | 자외선 5 | 35·20·10·15·10 | |
-| 가드닝각 | 자외선 5 | 25·30·10·15·10 | |
+| 피크닉각 | 자외선 10, 햇빛 10 | 20·20·15·5·10 | |
+| 등산각 | 자외선 10, 햇빛 10, 가시거리 5 | 20·20·15·5·10 | |
+| 자전거각 | 자외선 10, 햇빛 10 | 20·20·20·5·10 | 돌풍 15m/s 이상 |
+| 가드닝각 | 자외선 10, 햇빛 10 | 20·25·10·10·10 | |
+| 세차각 | 자외선 10, 햇빛 10 | 5·40·10·10·10 | |
| 별보기각 | 가시거리 15 | 5·10·5·5·15 (시간대 45 그대로) | |
| 사진산책각 | 가시거리 10 | 10·25·10·5·10 (시간대 30 그대로) | |
-| 자전거각 | | 변경 없음 | 돌풍 15m/s 이상 |
+| 멍뭉산책각 | | 40·25·10·5·15 | 지표면 온도 45° 이상 |
+| 러닝각 | | 35·20·10·15·15 | |
| 캠핑각 | | 변경 없음 | 돌풍 15m/s 이상 |
-- 나머지 17개 지수는 점수가 바뀌지 않는다 (적용 전후 비교로 확인).
+- 해가 떠 있는 시간대의 야외 활동(피크닉·등산·자전거·가드닝·세차)은 햇빛과 자외선을 **같은 비중(10씩)으로 함께** 둔다. 햇빛은 많을수록, 자외선은 낮을수록 점수가 높다. 자외선만 있으면 흐린 날이 "자외선 낮음 = 좋음"으로 맑은 날보다 높게 나오고, 햇빛만 있으면 한여름 강한 자외선을 놓친다.
+- 러닝각(6~8·19~22시)·멍뭉산책각(7~9·17~20시)은 자외선을 뺐다. 이른 아침·저녁이라 자외선이 늘 0이라 점수를 가르지 못했다. 그 비중은 러닝은 공기, 멍뭉산책은 기온으로 옮겼다. 사진산책각(일몰 무렵)도 같은 이유로 햇빛·자외선을 두지 않는다.
- 비중·기준값은 초안이다. 수치는 `seed/index_definition.json`에서 바꾸고 `load_seed.py`로 다시 넣는다.
### 3시간 구간을 계산 창에 연결하는 규칙
diff --git a/backend/seed/index_definition.json b/backend/seed/index_definition.json
index 7cefcc5..461d842 100644
--- a/backend/seed/index_definition.json
+++ b/backend/seed/index_definition.json
@@ -87,13 +87,13 @@
"to": 16
}
],
- "weight_temp": 25,
- "weight_rain": 25,
+ "weight_temp": 20,
+ "weight_rain": 20,
"weight_wind": 15,
"weight_humidity": 5,
"weight_air": 10,
"weight_uv": 10,
- "weight_sun": 0,
+ "weight_sun": 10,
"weight_view": 0,
"weight_time": 10,
"factor_rules": {
@@ -126,6 +126,10 @@
"uv": {
"zero": 8,
"full": 2
+ },
+ "sun": {
+ "zero": 0.2,
+ "full": 0.8
}
},
"zero_rules": [
@@ -376,13 +380,13 @@
"to": 12
}
],
- "weight_temp": 25,
- "weight_rain": 25,
- "weight_wind": 20,
+ "weight_temp": 20,
+ "weight_rain": 20,
+ "weight_wind": 15,
"weight_humidity": 5,
"weight_air": 10,
- "weight_uv": 5,
- "weight_sun": 0,
+ "weight_uv": 10,
+ "weight_sun": 10,
"weight_view": 5,
"weight_time": 5,
"factor_rules": {
@@ -420,6 +424,10 @@
"view": {
"zero": 5,
"full": 20
+ },
+ "sun": {
+ "zero": 0.2,
+ "full": 0.8
}
},
"zero_rules": [
@@ -460,12 +468,12 @@
}
],
"weight_temp": 5,
- "weight_rain": 60,
+ "weight_rain": 40,
"weight_wind": 10,
"weight_humidity": 10,
"weight_air": 10,
- "weight_uv": 0,
- "weight_sun": 0,
+ "weight_uv": 10,
+ "weight_sun": 10,
"weight_view": 0,
"weight_time": 5,
"factor_rules": {
@@ -488,6 +496,14 @@
"time": {
"type": "fixed",
"value": 100
+ },
+ "uv": {
+ "zero": 8,
+ "full": 2
+ },
+ "sun": {
+ "zero": 0.2,
+ "full": 0.8
}
},
"zero_rules": [
@@ -604,8 +620,8 @@
"weight_rain": 20,
"weight_wind": 10,
"weight_humidity": 15,
- "weight_air": 10,
- "weight_uv": 5,
+ "weight_air": 15,
+ "weight_uv": 0,
"weight_sun": 0,
"weight_view": 0,
"weight_time": 5,
@@ -629,10 +645,6 @@
"time": {
"type": "fixed",
"value": 100
- },
- "uv": {
- "zero": 8,
- "full": 2
}
},
"zero_rules": [
@@ -968,13 +980,13 @@
"to": 19
}
],
- "weight_temp": 25,
- "weight_rain": 25,
- "weight_wind": 30,
+ "weight_temp": 20,
+ "weight_rain": 20,
+ "weight_wind": 20,
"weight_humidity": 5,
"weight_air": 10,
- "weight_uv": 0,
- "weight_sun": 0,
+ "weight_uv": 10,
+ "weight_sun": 10,
"weight_view": 0,
"weight_time": 5,
"factor_rules": {
@@ -1003,6 +1015,14 @@
"sun": 100,
"holiday": 100,
"default": 70
+ },
+ "uv": {
+ "zero": 8,
+ "full": 2
+ },
+ "sun": {
+ "zero": 0.2,
+ "full": 0.8
}
},
"zero_rules": [
@@ -1050,12 +1070,12 @@
"to": 20
}
],
- "weight_temp": 35,
+ "weight_temp": 40,
"weight_rain": 25,
"weight_wind": 10,
"weight_humidity": 5,
"weight_air": 15,
- "weight_uv": 5,
+ "weight_uv": 0,
"weight_sun": 0,
"weight_view": 0,
"weight_time": 5,
@@ -1082,10 +1102,6 @@
"time": {
"type": "fixed",
"value": 100
- },
- "uv": {
- "zero": 8,
- "full": 2
}
},
"zero_rules": [
@@ -1406,13 +1422,13 @@
"to": 10
}
],
- "weight_temp": 25,
- "weight_rain": 30,
+ "weight_temp": 20,
+ "weight_rain": 25,
"weight_wind": 10,
- "weight_humidity": 15,
+ "weight_humidity": 10,
"weight_air": 10,
- "weight_uv": 5,
- "weight_sun": 0,
+ "weight_uv": 10,
+ "weight_sun": 10,
"weight_view": 0,
"weight_time": 5,
"factor_rules": {
@@ -1442,6 +1458,10 @@
"uv": {
"zero": 8,
"full": 2
+ },
+ "sun": {
+ "zero": 0.2,
+ "full": 0.8
}
},
"zero_rules": [
From cd6769ccefd699a666fc89ed284fdab3995d73c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?=
Date: Thu, 8 Oct 2026 11:37:09 +0900
Subject: [PATCH 02/30] =?UTF-8?q?feat:=20=EB=85=B8=EC=9D=84=20=EC=A0=90?=
=?UTF-8?q?=EC=88=98=20=EB=A7=91=EC=9D=80=20=ED=95=98=EB=8A=98=2055?=
=?UTF-8?q?=EC=A0=90=EC=9C=BC=EB=A1=9C=20=EC=98=AC=EB=A6=AC=EA=B3=A0=20?=
=?UTF-8?q?=EA=B3=B5=EA=B8=B0=20=EB=B3=B4=EC=A0=95=EC=9D=80=20=EC=95=84?=
=?UTF-8?q?=EC=A3=BC=20=EB=BF=8C=EC=98=87=EA=B1=B0=EB=82=98=20=EC=8A=B5?=
=?UTF-8?q?=ED=95=9C=20=EB=82=A0=EB=A7=8C=20=EA=B9=8E=EB=8F=84=EB=A1=9D=20?=
=?UTF-8?q?=EC=99=84=ED=99=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/docs/openmeteo-data.md | 8 ++++----
backend/services/calc/sky_score.py | 8 ++++----
backend/tests/test_sky_api.py | 2 +-
backend/tests/test_sky_score.py | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/backend/docs/openmeteo-data.md b/backend/docs/openmeteo-data.md
index c128c29..015f3dc 100644
--- a/backend/docs/openmeteo-data.md
+++ b/backend/docs/openmeteo-data.md
@@ -40,17 +40,17 @@ Open-Meteo(`api.open-meteo.com/v1/forecast`)에서 받는 데이터와 저장
```
canvas = max(mid20, high20)
-f_canvas = 0.2 + 0.8 × canvas/50 (canvas ≤ 50) / max(0, 1 - (canvas-50)/50) (canvas > 50)
+f_canvas = 0.4 + 0.6 × canvas/50 (canvas ≤ 50) / max(0, 1 - (canvas-50)/50) (canvas > 50)
f_near = 1 - 0.8 × low20 / 100
light = 1 - min(low100 + 0.5×mid100, 100) / 100
구름 점수 = 100 × (0.75×f_canvas + 0.25×f_near) × (0.25 + 0.75×light)
점수 = min(100, round(모델 평균 구름 점수 × 공기 보정))
```
-- 맑은 하늘(구름 0%)은 40점(은은함)이고, 구름이 몇 %만 있어도 점수가 갈린다. 예전에는 10% 미만을 0.3으로 고정해 맑은 날 전국이 48점에 몰리고, 10%에서 점수가 오히려 떨어졌다.
+- 맑은 하늘(구름 0%)은 55점(은은함)이고, 구름이 몇 %만 있어도 점수가 갈린다. 예전에는 10% 미만을 0.3으로 고정해 맑은 날 전국이 48점에 몰리고, 10%에서 점수가 오히려 떨어졌다.
- 공기 보정 (`air_factor`, 구 중심 해 질·뜰 무렵 값. 값이 없으면 ×1.0):
- - 가시거리(`openmeteo_hourly.visibility_m`, 가장 가까운 3시간 구간): 40km 이상 ×1.0 ~ 5km 이하 ×0.6. 뿌연 공기는 색을 흐린다.
- - 습도(`weather_hourly.humidity`, 가장 가까운 정시): 50% 이하 ×1.0 ~ 90% 이상 ×0.75.
+ - 가시거리(`openmeteo_hourly.visibility_m`, 가장 가까운 3시간 구간): 20km 이상 ×1.0 ~ 5km 이하 ×0.8. 뿌연 공기는 색을 흐린다.
+ - 습도(`weather_hourly.humidity`, 가장 가까운 정시): 70% 이하 ×1.0 ~ 90% 이상 ×0.85. 평소 날씨는 깎지 않고 아주 뿌옇거나 습한 날만 깎는다.
- 비 갠 뒤: 2~6시간 전 비 확률 60% 이상이고 그 시각 비 확률 40% 미만이면 ×1.15.
- 모델마다 따로 계산해 **평균**을 최종 점수로 쓰고, 모델 점수의 표준편차로 신뢰도를 정한다 (8 미만 높음, 15 미만 보통, 그 이상 낮음). 모델이 2개 미만이면 낮음. 신뢰도는 공기 보정 전 구름 점수로 본다.
- 등급: 80 이상 붉음, 60 이상 고움, 40 이상 은은함, 그 미만 흐림.
diff --git a/backend/services/calc/sky_score.py b/backend/services/calc/sky_score.py
index 9cfb0f6..701b923 100644
--- a/backend/services/calc/sky_score.py
+++ b/backend/services/calc/sky_score.py
@@ -5,8 +5,8 @@ from datetime import datetime, timedelta
from common.enums import Confidence, SkyGrade, SkySituation, SkyType
DISTANCES_KM = (20, 100)
-# 물들 구름이 하나도 없을 때의 canvas 값. 50% 까지 곧게 올라가 맑은 날도 구름 몇 % 차이로 점수가 갈린다 (맑은 하늘 40점 = 은은함).
-_CLEAR_CANVAS = 0.2
+# 물들 구름이 하나도 없을 때의 canvas 값. 50% 까지 곧게 올라가 맑은 날도 구름 몇 % 차이로 점수가 갈린다 (맑은 하늘 55점 = 은은함).
+_CLEAR_CANVAS = 0.4
# 해 지기(뜨기) 이만큼 전 사이에 비가 왔다가 그 시각엔 개면 공기가 맑고 구름이 남아 더 붉다.
RAIN_BEFORE_HOURS = (2, 6)
@@ -46,9 +46,9 @@ def air_factor(air: Air) -> float:
"""공기로 구름 점수를 보정하는 배수. 뿌연 공기·높은 습도는 색을 흐리게 하고, 비 갠 뒤는 더 붉다."""
f = 1.0
if air.visibility_km is not None:
- f *= _ramp(air.visibility_km, 5, 40, 0.6)
+ f *= _ramp(air.visibility_km, 5, 20, 0.8)
if air.humidity is not None:
- f *= _ramp(air.humidity, 90, 50, 0.75)
+ f *= _ramp(air.humidity, 90, 70, 0.85)
if air.rain_before is not None and air.rain_before >= 60 and (air.rain_now or 0) < 40:
f *= 1.15
return f
diff --git a/backend/tests/test_sky_api.py b/backend/tests/test_sky_api.py
index 6acc19b..c5fc60b 100644
--- a/backend/tests/test_sky_api.py
+++ b/backend/tests/test_sky_api.py
@@ -160,7 +160,7 @@ def test_score_rows_apply_air_at_sunset_and_keep_cloud_score_without_air():
hourly = {("R", hour): SimpleNamespace(humidity=90, rain_prob=0)}
om = {("R", sky_service._nearest_slot(hour)): SimpleNamespace(visibility_m=5000)}
hazy = sky_service._score_rows(region, today, clouds, now, hourly, om)[0]["score"]
- assert hazy == round(plain * 0.6 * 0.75)
+ assert hazy == round(plain * 0.8 * 0.85)
rain = {("R", hour - timedelta(hours=3)): SimpleNamespace(humidity=50, rain_prob=80), ("R", hour): SimpleNamespace(humidity=50, rain_prob=10)}
assert sky_service._score_rows(region, today, clouds, now, rain, {})[0]["score"] == min(100, round(plain * 1.15))
diff --git a/backend/tests/test_sky_score.py b/backend/tests/test_sky_score.py
index 6bae052..056f2a8 100644
--- a/backend/tests/test_sky_score.py
+++ b/backend/tests/test_sky_score.py
@@ -26,9 +26,9 @@ def test_score_rises_steadily_with_a_few_clouds():
def test_air_factor_hazy_humid_lowers_and_clearing_rain_raises():
assert air_factor(Air()) == 1.0
- assert air_factor(Air(visibility_km=40, humidity=50)) == 1.0
- assert air_factor(Air(visibility_km=5)) == 0.6 and air_factor(Air(humidity=90)) == 0.75
- assert 0.6 < air_factor(Air(visibility_km=30)) < 1.0
+ assert air_factor(Air(visibility_km=20, humidity=70)) == 1.0
+ assert air_factor(Air(visibility_km=5)) == 0.8 and air_factor(Air(humidity=90)) == 0.85
+ assert 0.8 < air_factor(Air(visibility_km=12.5)) < 1.0
assert air_factor(Air(rain_before=70, rain_now=10)) == 1.15
assert air_factor(Air(rain_before=70, rain_now=60)) == 1.0 # 아직 비 오는 중이면 가산 없음
From 3857ef8d14ea0b208e4fadc1827e3d6717749473 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?=
Date: Thu, 8 Oct 2026 11:59:08 +0900
Subject: [PATCH 03/30] =?UTF-8?q?feat:=20=EB=85=B8=EC=9D=84=20=EA=B3=B5?=
=?UTF-8?q?=EA=B8=B0=20=EB=B3=B4=EC=A0=95=EC=9D=84=20=ED=8F=89=EC=86=8C=20?=
=?UTF-8?q?=EA=B3=B5=EA=B8=B0=20=EA=B8=B0=EC=A4=80=EC=A0=90=20=EC=A4=91?=
=?UTF-8?q?=EC=8B=AC=EC=9C=BC=EB=A1=9C=20=EB=B0=94=EA=BF=94=20=EB=A7=91?=
=?UTF-8?q?=EC=9D=80=20=EB=82=A0=20=EC=A0=90=EC=88=98=EA=B0=80=20=ED=95=9C?=
=?UTF-8?q?=20=EC=A0=90=EC=97=90=20=EB=AA=B0=EB=A6=AC=EC=A7=80=20=EC=95=8A?=
=?UTF-8?q?=EA=B2=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/docs/openmeteo-data.md | 6 +++---
backend/services/calc/sky_score.py | 23 ++++++++++++++++-------
backend/tests/test_sky_api.py | 2 +-
backend/tests/test_sky_score.py | 7 ++++---
4 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/backend/docs/openmeteo-data.md b/backend/docs/openmeteo-data.md
index 015f3dc..be49e6f 100644
--- a/backend/docs/openmeteo-data.md
+++ b/backend/docs/openmeteo-data.md
@@ -48,9 +48,9 @@ light = 1 - min(low100 + 0.5×mid100, 100) / 100
```
- 맑은 하늘(구름 0%)은 55점(은은함)이고, 구름이 몇 %만 있어도 점수가 갈린다. 예전에는 10% 미만을 0.3으로 고정해 맑은 날 전국이 48점에 몰리고, 10%에서 점수가 오히려 떨어졌다.
-- 공기 보정 (`air_factor`, 구 중심 해 질·뜰 무렵 값. 값이 없으면 ×1.0):
- - 가시거리(`openmeteo_hourly.visibility_m`, 가장 가까운 3시간 구간): 20km 이상 ×1.0 ~ 5km 이하 ×0.8. 뿌연 공기는 색을 흐린다.
- - 습도(`weather_hourly.humidity`, 가장 가까운 정시): 70% 이하 ×1.0 ~ 90% 이상 ×0.85. 평소 날씨는 깎지 않고 아주 뿌옇거나 습한 날만 깎는다.
+- 공기 보정 (`air_factor`, 구 중심 해 질·뜰 무렵 값. 값이 없으면 ×1.0). 평소 공기(가시거리 20km·습도 60%)를 ×1.0 으로 두고 좋으면 올리고 나쁘면 내린다. 맑은 날 전국이 한 점수(구름 0% = 55점)에 몰리지 않게 하려는 것:
+ - 가시거리(`openmeteo_hourly.visibility_m`, 가장 가까운 3시간 구간): 5km 이하 ×0.8 · 20km ×1.0 · 40km 이상 ×1.12, 사이는 직선. 뿌연 공기는 색을 흐리고 맑은 공기는 더 선명하다.
+ - 습도(`weather_hourly.humidity`, 가장 가까운 정시): 40% 이하 ×1.06 · 60% ×1.0 · 90% 이상 ×0.85, 사이는 직선.
- 비 갠 뒤: 2~6시간 전 비 확률 60% 이상이고 그 시각 비 확률 40% 미만이면 ×1.15.
- 모델마다 따로 계산해 **평균**을 최종 점수로 쓰고, 모델 점수의 표준편차로 신뢰도를 정한다 (8 미만 높음, 15 미만 보통, 그 이상 낮음). 모델이 2개 미만이면 낮음. 신뢰도는 공기 보정 전 구름 점수로 본다.
- 등급: 80 이상 붉음, 60 이상 고움, 40 이상 은은함, 그 미만 흐림.
diff --git a/backend/services/calc/sky_score.py b/backend/services/calc/sky_score.py
index 701b923..63dfaf0 100644
--- a/backend/services/calc/sky_score.py
+++ b/backend/services/calc/sky_score.py
@@ -36,19 +36,28 @@ def score(near20: Layers, far100: Layers) -> int:
return round(100 * (0.75 * f_canvas + 0.25 * f_near) * (0.25 + 0.75 * light))
-def _ramp(v: float, bad: float, good: float, low: float) -> float:
- """good 쪽은 1.0, bad 쪽은 low, 사이는 직선."""
- t = max(0.0, min(1.0, (v - bad) / (good - bad)))
- return low + (1 - low) * t
+# 공기 보정 기준점 (값, 배수). 평소 공기(가시거리 20km, 습도 60%)가 ×1.0 이고 좋으면 올리고 나쁘면 내린다. 양 끝 밖은 끝 값 그대로.
+_VISIBILITY_FACTOR = ((5, 0.8), (20, 1.0), (40, 1.12))
+_HUMIDITY_FACTOR = ((40, 1.06), (60, 1.0), (90, 0.85))
+
+
+def _interp(v: float, points: tuple[tuple[float, float], ...]) -> float:
+ """기준점 사이를 직선으로 잇는다."""
+ if v <= points[0][0]:
+ return points[0][1]
+ for (x0, f0), (x1, f1) in zip(points, points[1:]):
+ if v <= x1:
+ return f0 + (f1 - f0) * (v - x0) / (x1 - x0)
+ return points[-1][1]
def air_factor(air: Air) -> float:
- """공기로 구름 점수를 보정하는 배수. 뿌연 공기·높은 습도는 색을 흐리게 하고, 비 갠 뒤는 더 붉다."""
+ """공기로 구름 점수를 보정하는 배수. 맑고 건조하면 올리고 뿌옇거나 습하면 내린다. 비 갠 뒤는 더 붉다."""
f = 1.0
if air.visibility_km is not None:
- f *= _ramp(air.visibility_km, 5, 20, 0.8)
+ f *= _interp(air.visibility_km, _VISIBILITY_FACTOR)
if air.humidity is not None:
- f *= _ramp(air.humidity, 90, 70, 0.85)
+ f *= _interp(air.humidity, _HUMIDITY_FACTOR)
if air.rain_before is not None and air.rain_before >= 60 and (air.rain_now or 0) < 40:
f *= 1.15
return f
diff --git a/backend/tests/test_sky_api.py b/backend/tests/test_sky_api.py
index c5fc60b..c8be86e 100644
--- a/backend/tests/test_sky_api.py
+++ b/backend/tests/test_sky_api.py
@@ -161,7 +161,7 @@ def test_score_rows_apply_air_at_sunset_and_keep_cloud_score_without_air():
om = {("R", sky_service._nearest_slot(hour)): SimpleNamespace(visibility_m=5000)}
hazy = sky_service._score_rows(region, today, clouds, now, hourly, om)[0]["score"]
assert hazy == round(plain * 0.8 * 0.85)
- rain = {("R", hour - timedelta(hours=3)): SimpleNamespace(humidity=50, rain_prob=80), ("R", hour): SimpleNamespace(humidity=50, rain_prob=10)}
+ rain = {("R", hour - timedelta(hours=3)): SimpleNamespace(humidity=60, rain_prob=80), ("R", hour): SimpleNamespace(humidity=60, rain_prob=10)}
assert sky_service._score_rows(region, today, clouds, now, rain, {})[0]["score"] == min(100, round(plain * 1.15))
diff --git a/backend/tests/test_sky_score.py b/backend/tests/test_sky_score.py
index 056f2a8..5fd277e 100644
--- a/backend/tests/test_sky_score.py
+++ b/backend/tests/test_sky_score.py
@@ -24,11 +24,12 @@ def test_score_rises_steadily_with_a_few_clouds():
assert scores == sorted(scores) and len(set(scores)) == len(scores) # 맑은 날도 구름 몇 %로 갈리고 10%에서 꺾이지 않는다
-def test_air_factor_hazy_humid_lowers_and_clearing_rain_raises():
+def test_air_factor_centers_on_usual_air_and_clearing_rain_raises():
assert air_factor(Air()) == 1.0
- assert air_factor(Air(visibility_km=20, humidity=70)) == 1.0
+ assert air_factor(Air(visibility_km=20, humidity=60)) == 1.0 # 평소 공기
assert air_factor(Air(visibility_km=5)) == 0.8 and air_factor(Air(humidity=90)) == 0.85
- assert 0.8 < air_factor(Air(visibility_km=12.5)) < 1.0
+ assert air_factor(Air(visibility_km=40)) == 1.12 and air_factor(Air(humidity=40)) == 1.06 # 맑고 건조하면 올라간다
+ assert 0.8 < air_factor(Air(visibility_km=12.5)) < 1.0 < air_factor(Air(visibility_km=30)) < 1.12
assert air_factor(Air(rain_before=70, rain_now=10)) == 1.15
assert air_factor(Air(rain_before=70, rain_now=60)) == 1.0 # 아직 비 오는 중이면 가산 없음
From 5a5f585bdac9726824b0194a18658e9589badfd8 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Thu, 8 Oct 2026 17:09:12 +0900
Subject: [PATCH 04/30] =?UTF-8?q?feat:=20=EA=B0=81=20=ED=83=AD=C2=B7?=
=?UTF-8?q?=EC=8A=A4=ED=86=A0=EB=A6=AC=C2=B7=EA=B0=81=20=EC=83=81=EC=84=B8?=
=?UTF-8?q?=EC=97=90=20=EC=A7=80=EA=B8=88=20=EA=B5=AC=EA=B0=84=20=EC=A0=90?=
=?UTF-8?q?=EC=88=98=EC=99=80=20=EC=95=84=EC=B9=A8=C2=B7=EB=82=AE=C2=B7?=
=?UTF-8?q?=EC=A0=80=EB=85=81=C2=B7=EB=B0=A4=20=EC=B9=B8,=20=ED=9E=88?=
=?UTF-8?q?=EC=96=B4=EB=A1=9C=20'=EC=A7=80=EA=B8=88=20=EB=82=A0=EC=94=A8?=
=?UTF-8?q?=20=EC=A0=90=EC=88=98'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 4 +-
docs/meetings/2026-10-08.md | 36 +++++++++++++
docs/점수_계산식.md | 36 +++++++++----
.../api/client/@tanstack/react-query.gen.ts | 2 +-
frontend/src/api/client/index.ts | 2 +-
frontend/src/api/client/sdk.gen.ts | 2 +-
frontend/src/api/client/types.gen.ts | 50 ++++++++++++++++++-
frontend/src/b/GakPage.tsx | 10 ++--
frontend/src/b/Sheets.tsx | 22 +++++++-
frontend/src/b/TodayPage.tsx | 14 ++++--
10 files changed, 152 insertions(+), 26 deletions(-)
create mode 100644 docs/meetings/2026-10-08.md
diff --git a/TODO.md b/TODO.md
index 14d06d5..5cedabd 100644
--- a/TODO.md
+++ b/TODO.md
@@ -141,8 +141,8 @@
| [x] | 좋아요·댓글이 전국 공통 — 포스트가 (날짜, 자리) 하나로 전국에 하나뿐이라, 구마다 내용이 다른 카드(오늘 날씨·각 1~3위·노을·미세먼지·행사)도 댓글·좋아요를 전국이 같이 씀. 예: 강남의 "1위 산책각"과 부산의 "1위 빨래각"이 같은 댓글창. 안: 지역 데이터 카드만 시도(17) 단위로 나누고 계절·상식·명언은 전국 공통 유지 | 사용자 질문 (10/8) | `backend/postgres-init/init.sql` (`uq_post_feed`), `backend/services/feed_service.py` (`build_day`, `_gak`) |
| [ ] | **[결정 필요]** 포스트 시도 단위가 17이 아니라 16 — `region.code` 앞 2자리에서 광주·전남이 둘 다 `12`(전남광주통합특별시)라 같은 댓글창을 씀. 그대로 둘지, 이름 앞머리로 광주·전남을 나눌지 | 포스트 시도 나누기 (10/8) | `backend/services/feed_service.py` (`sido_of`), `backend/seed/region.csv` |
| [ ] | 광주·전남 구는 행사가 안 잡힐 수 있음 — 구 코드 시도는 `12`인데 행사 수집·`event.sido_code`는 `29`(광주)·`46`(전남). 좌표 없는 행사는 `is_nearby`·`nearby_sidos`에서 빠짐 | 포스트 시도 나누기 중 발견 (10/8) | `backend/services/week_service.py:125,144`, `backend/services/external/culture_api.py:28` |
-| [x] | 전체 날씨 점수 기준 강화 — 100점은 '1년에 하루' 수준으로만 → 각과 같은 계산에 기준만 좁힘(체감 21±0.5°·습도 45~55%·해 90%↑·바람 1m/s↓·초미세먼지 10↓, 사용자 결정 '기준만 좁히기'). 실제 연 몇 번 나오는지는 미확인 (`docs/점수_계산식.md` 2) | 10/8 회의 결정 | `backend/services/index_service.py:203` |
-| [ ] | 각 점수를 아침·낮·저녁·밤 시간대별로 — 지금은 하루 중 가장 좋은 시간대 점수로 하루 고정이라 비가 와도 안 바뀜 | 10/8 회의 결정 | `backend/services/calc/index_calc.py:297` |
+| [x] | 전체 날씨 점수 기준 강화 — 100점은 '1년에 하루' 수준으로만 → 각과 같은 계산에 기준만 좁힘(체감 21±0.5°·습도 45~55%·해 90%↑·바람 1m/s↓·초미세먼지 10↓, 사용자 결정 '기준만 좁히기'). 실제 연 몇 번 나오는지는 미확인 (`docs/점수_계산식.md` 3) | 10/8 회의 결정 | `backend/services/index_service.py:203` |
+| [x] | 각 점수를 아침·낮·저녁·밤 시간대별로 → 지금 구간 점수로 순위, 안 겹치는 각은 순위·피드에서 빼고 스토리·전체엔 '지금 아님'. 히어로는 '지금 날씨 점수'(지금 구간). 운영 DB에 `index_score.slots` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 10/8 회의 결정 | `backend/services/calc/index_calc.py:297` |
| [ ] | 히어로에 습도·불쾌지수 항상 표시 — 지금은 상황별 두 칸이라 불쾌지수는 일정 수치 이상일 때만 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
| [ ] | 달 '밝기 %' 정의(밝기인지 보이는 면적인지) + 구름·달 모양 반영 산정 로직 | 10/8 회의 | `backend/services/calc/moon.py` |
| [ ] | 노을: 하늘 상황 문구 대신 점수 강조(10/7 다시 기획에서 되돌림). 골든아워·블루아워 설명은 시간표 아래에 넣음 | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
diff --git a/docs/meetings/2026-10-08.md b/docs/meetings/2026-10-08.md
new file mode 100644
index 0000000..9dba73b
--- /dev/null
+++ b/docs/meetings/2026-10-08.md
@@ -0,0 +1,36 @@
+# 2026-10-08(목) 회의 — 날씨각
+
+## 수정
+- 전체 날씨 점수 기준 강화. 100점은 '1년에 하루 있을까' 수준으로만 (결정) — 각 점수만 낮췄고 총점은 그대로라 100점이 계속 나옴. 총점과 각 점수의 흐름도 맞아야 함 (`backend/services/index_service.py:203`)
+- 각 점수를 아침·낮·저녁·밤 시간대별로 바뀌게 (결정) — 지금은 하루 중 가장 좋은 시간대 점수로 하루 고정이라 비가 와도 안 바뀜 (`backend/services/calc/index_calc.py:297`)
+- 노을 순위 분포 넓히기 — 10위까지 4점 차로 몰림 (김성경 선임 진행 중)
+- 히어로에 습도·불쾌지수 항상 표시 (결정) — 지금은 상황별로 두 칸을 골라 불쾌지수는 일정 수치 이상일 때만 나옴 (`frontend/src/b/TodayPage.tsx`, `HeroStat`)
+- 달 '밝기 5%'가 밝기인지 보이는 면적인지 정의하고, 구름·달 모양을 반영한 산정 로직으로 (`backend/services/calc/moon.py`)
+- 노을은 하늘 상황 문구 대신 점수 강조 + 골든아워·블루아워 설명 추가 — 10/7 다시 기획(점수 대신 상황 5가지)을 되돌림 (사용자 결정) (`frontend/src/b/SkyPage.tsx`)
+- 주말 예보 UI 개선 (구체 내용 없음) (`frontend/src/b/WeekPage.tsx`)
+
+## 검색 등록 (우선)
+- 도메인은 지금처럼 별도 도메인 유지 (결정, Web4Ai 하위 경로 통합 안 함)
+- AEO·SEO 메타데이터를 넣고 구글·네이버 검색 등록부터 진행 (결정, 금일 핵심 업무) — 지금은 발행만 되고 등록 안 됨
+- 넣은 태그·키워드는 정의서로 정리 → 대표 보고
+- 콘텐츠가 매시간 바뀌는 데 맞는 재발행·노출 방식 정리 → 대표 보고 (TODO의 SEO 빌드 방식 [결정 필요] 행과 이어짐)
+- 사내 용어: '인덱싱' 대신 '검색 등록' (결정)
+
+## 워치 앱 (양 팀장)
+- 축제: 메인 1건을 크게, 주변 축제는 넘겨 보기
+- 날씨각 데이터 연동용 앱 등록에 구글 개발자 본인 인증 필요 (대표 또는 소장)
+
+## 담당·기한
+| 할 일 | 담당 | 기한 | 보고 |
+|---|---|---|---|
+| 날씨 점수 기준 강화, 시간대별 각 점수 | 김성경·최미나 | 미정 | 대표 보고 |
+| 히어로 습도·불쾌지수, 달 밝기 로직, 노을 점수·골든아워 설명 | 최미나 | 미정 | 대표 공유 |
+| 메타데이터 정의서, 구글·네이버 검색 등록 | 최미나 | 미정 | 대표 보고 |
+| 매시간 갱신 콘텐츠 검색 노출 방식 | 최미나 | 미정 | 대표 보고 |
+
+## 날씨각 외 (이 저장소 밖)
+- 스테이머뭄 중복 사이트 내리고 하나로 (최미나, 금일 핵심 업무)
+- 에드오트 신버전 정식 배포·봇/사람 분리 통계 (김성경, 10/14), 일반 키워드 메타데이터·FAQ
+- 동적 목표가 상승 편향 시뮬레이션 (양 팀장, 다음 주)
+- 챗봇 품질 검증 에이전트 기획 (양 팀장·소장)
+- Claude 크레딧 1만 달러 사용 계획 (6개월, 담당 미정)
diff --git a/docs/점수_계산식.md b/docs/점수_계산식.md
index 36ad77a..0079e6c 100644
--- a/docs/점수_계산식.md
+++ b/docs/점수_계산식.md
@@ -4,7 +4,7 @@
| 점수 | 화면 | 코드 |
|---|---|---|
-| 오늘 날씨 점수 | 오늘 탭 히어로 큰 숫자 | `backend/services/index_service.py` (`WEATHER_SCORE_DEF`) |
+| 지금 날씨 점수 | 오늘 탭 히어로 큰 숫자 | `backend/services/index_service.py` (`WEATHER_SCORE_DEF`) |
| 각 점수 | 각 탭, 피드 각 카드 | `backend/services/calc/index_calc.py` (`evaluate`) |
| 나들이 점수 | 주말 탭 전국 순위, 당일치기 카드 | `backend/services/calc/index_calc.py` (`outing`) |
| 노을 점수·판정 | 노을 탭, 피드 노을 카드, 노을 순위 | `backend/services/calc/sky_score.py`, `backend/services/sky_service.py` |
@@ -43,9 +43,20 @@
| 자외선·햇빛·가시거리 | zero, full | 직선 대신 곡선으로 zero→full |
| 정보 없음 | | 바람·미세먼지·자외선·햇빛·가시거리 정보가 없으면 70점 |
-## 2. 오늘 날씨 점수
+## 2. 시간대 구간
-오늘 낮 **9~21시**가 밖에 나가기 좋은 정도. 1의 방식으로 계산합니다.
+| 구간 | 시각 |
+|---|---|
+| 아침 | 5~11시 |
+| 낮 | 11시 ~ 일몰 2시간 전 |
+| 저녁 | 일몰 2시간 전 ~ 일몰 1시간 뒤 |
+| 밤 | 일몰 1시간 뒤 ~ 다음 날 5시 (0~5시는 전날 밤 구간) |
+
+한 시간은 그 시각 30분이 속한 구간에 넣습니다. 피드 카드 순서도 같은 구간을 씁니다 (`backend/services/calc/day_slot.py`).
+
+## 3. 지금 날씨 점수
+
+**지금 구간**의 모든 시각이 밖에 나가기 좋은 정도. 1의 방식으로 계산합니다. 밤에는 밤 날씨 기준이라 낮보다 낮게 나오기 쉽습니다.
| 요소 | 비중 | 100점 조건 |
|---|---:|---|
@@ -56,18 +67,21 @@
| 초미세먼지 | 10% | 10㎍/㎥ 이하 (75에서 0점) |
| 해 난 비율 (Open-Meteo) | 15% | 90% 이상 (20%에서 0점), 정보 없으면 70점 |
-여섯 가지가 동시에 맞아야 100점입니다. 기준값은 눈대중으로 잡은 것이며, 실제로 1년에 며칠 나오는지는 확인하지 않았습니다.
+여섯 가지가 동시에 맞아야 100점입니다. 기준값은 눈대중으로 잡은 것이며 (낮 기준 최적값을 밤에도 똑같이 씀), 실제로 1년에 며칠 나오는지는 확인하지 않았습니다.
예: 체감 22.5°, 비 10%, 바람 2.5m, 습도 62%, 초미세먼지 15, 해 70% → 95점 미만.
-## 3. 각 점수
+## 4. 각 점수
- 1의 방식. 요소·비중·시간대·0점 조건은 각마다 다르며 [각_계산기준.md](각_계산기준.md)에 있습니다.
-- **시간대가 여러 개면 그중 가장 좋은 시간대 점수**를 그날 점수로 씁니다. 그래서 하루 동안 바뀌지 않습니다.
+- **오늘 점수 = 지금 구간 점수.** 각의 시간대 중 지금 구간에 드는 시각만으로 계산합니다(시간대가 여러 개면 그중 가장 좋은 쪽). 비가 오면 그 뒤 구간 점수가 내려갑니다.
+- 각의 시간대가 지금 구간과 겹치지 않으면(예: 아침의 야장각) **순위·피드 카드·히어로 1위에서 빠집니다.** 스토리·각 탭 '전체'에는 맨 뒤에 '지금 아님'으로 남고, 점수는 하루 점수(가장 좋은 시간대)입니다.
+- 각 상세 창에 오늘 아침·낮·저녁·밤 점수를 보여 줍니다. 안 겹치는 구간은 '–'.
+- 내일·토·일 칸은 하루 점수(가장 좋은 시간대)입니다.
- 순위는 점수 × 중요도(상 1.0 · 중 0.85 · 하 0.7). 화면 숫자는 점수 그대로입니다.
- 단기예보가 닿지 않는 날(토·일 등)은 중기예보의 최저·최고 기온으로 시각별 기온을 어림하고(새벽 6시 최저, 오후 3시 최고, 코사인 곡선), 바람·습도·미세먼지는 정보 없음으로 둔 '예상 점수'입니다.
-## 4. 나들이 점수 (주말 순위·당일치기)
+## 5. 나들이 점수 (주말 순위·당일치기)
토·일 **10~17시** 기준.
@@ -84,7 +98,7 @@
- 전국 순위: 노을 순위 대표 30곳을 점수순으로 정렬합니다.
- 당일치기: 내 지역에서 직선 20~200km 안 후보 도시 중 토·일 중 더 좋은 날 점수가 가장 높은 곳입니다. 동점이면 비 확률이 낮은 곳 → 이른 날 → 가까운 곳 순입니다. 1위가 50점 미만이면 카드를 보이지 않습니다.
-## 5. 노을 점수
+## 6. 노을 점수
해 지는(뜨는) 시각에 가장 가까운 정시의 구름을, 해 지는 방향 **20km(머리 위)**와 **100km(먼 쪽)** 두 지점에서 봅니다. 예보 모델마다 계산해 평균합니다.
@@ -123,7 +137,7 @@
- 확신도: 모델별 점수의 표준편차가 8 미만이면 높음, 15 미만이면 보통, 그 이상이거나 모델이 1개면 낮음.
- 노을 순위: 대표 30곳을 노을 점수순으로 정렬합니다. 70% 이상이 같은 상황이면 한 줄 요약을 붙입니다.
-## 6. 노을 시각
+## 7. 노을 시각
| 시각 | 정의 |
|---|---|
@@ -134,12 +148,12 @@
일출은 순서가 거꾸로입니다(블루아워 → 가장 붉을 때 → 해 떠요).
-## 7. 달 밝기
+## 8. 달 밝기
- **밝기 = (1 − cos(2π × 삭에서 지난 비율)) ÷ 2**. 0이면 그믐(안 보임), 1이면 보름입니다. 삭 시각은 Meeus 계산(오차 2분 안)입니다.
- 달 모양에서 **빛나는 면의 비율**일 뿐, 구름·달 고도·월출 시각은 반영하지 않습니다.
-## 8. 불쾌지수
+## 9. 불쾌지수
- **불쾌지수 = 0.81 × 기온 + 0.01 × 습도 × (0.99 × 기온 − 14.3) + 46.3**
- 68 미만 쾌적 · 75 미만 보통 · 80 미만 불쾌 · 그 이상 매우 불쾌
diff --git a/frontend/src/api/client/@tanstack/react-query.gen.ts b/frontend/src/api/client/@tanstack/react-query.gen.ts
index 4cd028a..1cb695b 100644
--- a/frontend/src/api/client/@tanstack/react-query.gen.ts
+++ b/frontend/src/api/client/@tanstack/react-query.gen.ts
@@ -150,7 +150,7 @@ export const getSkyRankingOptions = (options?: Options) => qu
export const listIndicesQueryKey = (options: Options) => createQueryKey('listIndices', options);
/**
- * 지수 목록 (점수순, 1~3위, 오늘 날씨 점수)
+ * 지수 목록 (지금 구간 점수순, 1~3위, 지금 날씨 점수)
*/
export const listIndicesOptions = (options: Options) => queryOptions>({
queryFn: async ({ queryKey, signal }) => {
diff --git a/frontend/src/api/client/index.ts b/frontend/src/api/client/index.ts
index 943204f..38fbfa9 100644
--- a/frontend/src/api/client/index.ts
+++ b/frontend/src/api/client/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { addComment, deleteComment, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, listArticles, listComments, listEvents, listIndices, listPlaces, listRegions, listSaved, login, logout, me, nearestRegion, type Options, refresh, savePost, signup, unlikeComment, unlikePost, unsavePost, updateMe } from './sdk.gen';
-export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen';
+export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen';
diff --git a/frontend/src/api/client/sdk.gen.ts b/frontend/src/api/client/sdk.gen.ts
index feb504e..3e6ebe7 100644
--- a/frontend/src/api/client/sdk.gen.ts
+++ b/frontend/src/api/client/sdk.gen.ts
@@ -49,7 +49,7 @@ export const getSky = (options: Options(options?: Options): RequestResult => (options?.client ?? client).get({ url: '/v1/sky/ranking', ...options });
/**
- * 지수 목록 (점수순, 1~3위, 오늘 날씨 점수)
+ * 지수 목록 (지금 구간 점수순, 1~3위, 지금 날씨 점수)
*/
export const listIndices = (options: Options): RequestResult => (options.client ?? client).get({ url: '/v1/index/list', ...options });
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index e28896c..83a0b87 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
- baseUrl: `${string}://openapi.gen.json` | (string & {});
+ baseUrl: `${string}://${string}` | (string & {});
};
/**
@@ -743,6 +743,24 @@ export type IndexSummary = {
* Trend
*/
trend?: Array;
+ /**
+ * Active
+ *
+ * 지금 구간이 이 각의 시간대와 겹침. false 면 순위 밖, score 는 하루 점수
+ */
+ active?: boolean;
+ /**
+ * Slot
+ *
+ * score 가 어느 구간 점수인지 (지금 구간)
+ */
+ slot?: string | null;
+ /**
+ * Slots
+ *
+ * 오늘 구간별 점수. 각 시간대와 안 겹치는 구간은 없음
+ */
+ slots?: Array;
};
/**
@@ -1440,6 +1458,8 @@ export type ResIndexList = {
day?: string | null;
/**
* Weather Score
+ *
+ * 지금 날씨 점수 (지금 구간 기준)
*/
weather_score?: number | null;
/**
@@ -2154,6 +2174,28 @@ export const SkyType = { /**
*/
export type SkyType = typeof SkyType[keyof typeof SkyType];
+/**
+ * SlotPoint
+ */
+export type SlotPoint = {
+ /**
+ * Slot
+ *
+ * morning / day / evening / night
+ */
+ slot: string;
+ /**
+ * Label
+ *
+ * 아침 / 낮 / 저녁 / 밤
+ */
+ label: string;
+ /**
+ * Score
+ */
+ score: number;
+};
+
/**
* SlotTone
*/
@@ -2311,6 +2353,12 @@ export type TopIndex = {
* Summary
*/
summary?: string | null;
+ /**
+ * Active
+ *
+ * 지금 구간이 이 각의 시간대와 겹침. false 면 순위 밖, score 는 하루 점수
+ */
+ active?: boolean;
};
/**
diff --git a/frontend/src/b/GakPage.tsx b/frontend/src/b/GakPage.tsx
index f1b1787..e35261c 100644
--- a/frontend/src/b/GakPage.tsx
+++ b/frontend/src/b/GakPage.tsx
@@ -124,12 +124,16 @@ export function GakPage() {
{spots.map((p) => (
From 3a73a44cb0e5df1063eab4ea59d79b7076742d24 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Thu, 8 Oct 2026 17:20:06 +0900
Subject: [PATCH 07/30] =?UTF-8?q?feat:=20=ED=9E=88=EC=96=B4=EB=A1=9C=20?=
=?UTF-8?q?=EC=B9=B8=EC=9D=84=20=EC=A7=80=EA=B8=88=C2=B7=EC=8A=B5=EB=8F=84?=
=?UTF-8?q?=C2=B7=EB=B6=88=EC=BE=8C=EC=A7=80=EC=88=98=C2=B7=EC=83=81?=
=?UTF-8?q?=ED=99=A9=201=EC=B9=B8=EC=9C=BC=EB=A1=9C=20=E2=80=94=20?=
=?UTF-8?q?=EC=8A=B5=EB=8F=84=C2=B7=EB=B6=88=EC=BE=8C=EC=A7=80=EC=88=98=20?=
=?UTF-8?q?=EB=8A=98=20=ED=91=9C=EC=8B=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 2 +-
backend/router/v1/feed/protocol.py | 5 +++--
backend/services/feed_service.py | 3 ++-
backend/services/hero_stats.py | 12 ++----------
backend/tests/test_hero_stats.py | 13 +++++++------
frontend/src/api/client/types.gen.ts | 10 +++++++++-
frontend/src/b/TodayPage.tsx | 9 +++++++--
7 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/TODO.md b/TODO.md
index 2a54985..b880681 100644
--- a/TODO.md
+++ b/TODO.md
@@ -143,7 +143,7 @@
| [ ] | 광주·전남 구는 행사가 안 잡힐 수 있음 — 구 코드 시도는 `12`인데 행사 수집·`event.sido_code`는 `29`(광주)·`46`(전남). 좌표 없는 행사는 `is_nearby`·`nearby_sidos`에서 빠짐 | 포스트 시도 나누기 중 발견 (10/8) | `backend/services/week_service.py:125,144`, `backend/services/external/culture_api.py:28` |
| [x] | 전체 날씨 점수 기준 강화 — 100점은 '1년에 하루' 수준으로만 → 각과 같은 계산에 기준만 좁힘(체감 21±0.5°·습도 45~55%·해 90%↑·바람 1m/s↓·초미세먼지 10↓, 사용자 결정 '기준만 좁히기'). 실제 연 몇 번 나오는지는 미확인 (`docs/점수_계산식.md` 3) | 10/8 회의 결정 | `backend/services/index_service.py:203` |
| [x] | 각 점수를 아침·낮·저녁·밤 시간대별로 → 지금 구간 점수로 순위, 안 겹치는 각은 순위·피드에서 빼고 스토리·전체엔 '지금 아님'. 히어로는 '지금 날씨 점수'(지금 구간). 운영 DB에 `index_score.slots` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 10/8 회의 결정 | `backend/services/calc/index_calc.py:297` |
-| [ ] | 히어로에 습도·불쾌지수 항상 표시 — 지금은 상황별 두 칸이라 불쾌지수는 일정 수치 이상일 때만 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
+| [x] | 히어로에 습도·불쾌지수 항상 표시 → 4칸(지금·습도·불쾌지수·상황 1칸, 사용자 결정). 불쾌지수 75 이상이면 경고 색, 상황 칸 후보에서 불쾌지수 뺌 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
| [ ] | 달 '밝기 %' 정의(밝기인지 보이는 면적인지) + 구름·달 모양 반영 산정 로직 | 10/8 회의 | `backend/services/calc/moon.py` |
| [x] | 노을: 점수 강조(히어로에 점수 크게) + 골든아워·블루아워 설명. 결론은 다음에 오는 것(해 뜨기 전·밤엔 일출, 그 사이엔 노을)으로, 피드 노을 카드도 같이 (사용자 결정 '각·노을도 지금 기준') | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
| [ ] | 주말 예보 UI 개선 — 회의에서 구체 내용 없음 | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
diff --git a/backend/router/v1/feed/protocol.py b/backend/router/v1/feed/protocol.py
index b495804..f5d3d74 100644
--- a/backend/router/v1/feed/protocol.py
+++ b/backend/router/v1/feed/protocol.py
@@ -146,7 +146,8 @@ class Hero(WebPacketProtocol):
sky_mode: Literal["morning", "day", "sunset", "night"]
temp_c: Optional[float] = None
feels_c: Optional[float] = None
- discomfort: Optional[int] = None
+ humidity: Optional[int] = Field(default=None, description="지금 습도 %. 히어로에 늘 보인다")
+ discomfort: Optional[int] = Field(default=None, description="지금 불쾌지수. 히어로에 늘 보인다")
discomfort_label: Optional[str] = None
rain_2h_text: Optional[str] = None
will_rain_2h: Optional[bool] = None
@@ -155,7 +156,7 @@ class Hero(WebPacketProtocol):
bubble: Optional[str] = None
moon_name: Optional[str] = Field(default=None, description="오늘 밤 달 모양: 삭·초승달·상현달·차오르는 달·보름달·기우는 달·하현달·그믐달")
moon_pct: Optional[int] = Field(default=None, description="달이 밝게 보이는 비율 0~100")
- stats: list[HeroStat] = Field(default_factory=list, description="히어로 두 칸. 지금 챙길 것(비·미세먼지·자외선·일교차·체감·불쾌지수) 먼저")
+ stats: list[HeroStat] = Field(default_factory=list, description="히어로 상황 칸 1개. 지금 챙길 것(비·미세먼지·자외선·일교차·체감) 먼저")
class BandEvent(WebPacketProtocol):
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index 90e5ed9..a84a49e 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -144,7 +144,7 @@ def _hero_input(now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: O
rain_later_at=later, today_known=bool(ahead),
air=AirGrade(now_w.air.grade) if now_w and now_w.air and now_w.air.grade is not None else None, uv=uv,
temp_min=min(temps, default=None), temp_max=max(temps, default=None),
- temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None, discomfort=cur.discomfort_index if cur else None,
+ temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None,
moon=phase_name(_tonight(now)),
)
@@ -430,6 +430,7 @@ class FeedService:
return Hero(
now_at=now, sky_mode=_SKY_MODE[slot],
temp_c=float(cur.temp_c) if cur else None, feels_c=float(cur.feels_c) if cur else None,
+ humidity=cur.humidity if cur else None,
discomfort=cur.discomfort_index if cur else None, discomfort_label=_discomfort_label(cur.discomfort_index) if cur else None,
rain_2h_text=now_w.rain_2h_text if now_w else None, will_rain_2h=now_w.will_rain_2h if now_w else None,
weather_score=board.weather_score if board else None, top1=_top(top) if top else None, bubble=bubble,
diff --git a/backend/services/hero_stats.py b/backend/services/hero_stats.py
index 02b501c..031f777 100644
--- a/backend/services/hero_stats.py
+++ b/backend/services/hero_stats.py
@@ -12,8 +12,7 @@ Tone = Literal["normal", "warn", "rain"]
UV_HIGH = 6.0
TEMP_SWING_C = 10.0
WIND_CHILL_C = 3.0
-MUGGY = 75
-SHOWN = 2
+SHOWN = 1
@dataclass(frozen=True)
@@ -38,7 +37,6 @@ class HeroInput:
temp_max: Optional[float] = None
temp: Optional[float] = None
feels: Optional[float] = None
- discomfort: Optional[int] = None
moon: Optional[str] = None
@@ -46,16 +44,12 @@ def uv_label(uv: float) -> str:
return "낮음" if uv < 3 else "보통" if uv < 6 else "높음" if uv < 8 else "매우 높음" if uv < 11 else "위험"
-def _discomfort_label(v: int) -> str:
- return "보통" if v < 75 else "높음" if v < 80 else "매우 높음"
-
-
def _rain_value(now: datetime, at: datetime) -> str:
return "지금 와요" if at <= now else f"{hour_label(at.astimezone(KST).hour)}쯤 와요"
def hero_stats(x: HeroInput) -> list[HeroStatItem]:
- """히어로 두 칸. 지금 챙겨야 할 것(경고)을 먼저, 모자라면 기본값으로 채운다."""
+ """히어로 상황 칸 (습도·불쾌지수는 늘 따로 보인다). 지금 챙겨야 할 것(경고)을 먼저, 모자라면 기본값으로 채운다."""
alerts: list[HeroStatItem] = []
if x.rain_at is not None:
alerts.append(HeroStatItem("rain", "umbrella", "지금 비", _rain_value(x.now, x.rain_at), "rain"))
@@ -69,8 +63,6 @@ def hero_stats(x: HeroInput) -> list[HeroStatItem]:
alerts.append(HeroStatItem("swing", "coldwind", f"일교차 {round(x.temp_max - x.temp_min)}°", "아침엔 겉옷"))
if x.temp is not None and x.feels is not None and x.temp - x.feels >= WIND_CHILL_C:
alerts.append(HeroStatItem("chill", "coldwind", f"체감 {round(x.feels)}°", "바람 쌀쌀"))
- if x.discomfort is not None and x.discomfort >= MUGGY:
- alerts.append(HeroStatItem("muggy", "muggy", "불쾌지수", f"{x.discomfort} · {_discomfort_label(x.discomfort)}", "warn"))
# 챙길 게 없을 땐 하루 기준 비 소식과 밤의 달만. '미세먼지 좋음'·'자외선 낮음' 같은 값으로 칸을 채우지 않는다
fills: list[HeroStatItem] = []
diff --git a/backend/tests/test_hero_stats.py b/backend/tests/test_hero_stats.py
index d7b0cc0..fb0ef59 100644
--- a/backend/tests/test_hero_stats.py
+++ b/backend/tests/test_hero_stats.py
@@ -12,8 +12,9 @@ def _view(x: HeroInput) -> list[tuple[str, str, str, str]]:
def test_clear_day_shows_uv_warning_and_temp_swing():
- x = HeroInput(now=NOW, night=False, air=AirGrade.GOOD, uv=6.1, temp_min=13, temp_max=23, temp=23, feels=23, discomfort=68)
- assert _view(x) == [("glasses", "자외선", "6 · 높음", "warn"), ("coldwind", "일교차 10°", "아침엔 겉옷", "normal")]
+ x = HeroInput(now=NOW, night=False, air=AirGrade.GOOD, uv=6.1, temp_min=13, temp_max=23, temp=23, feels=23)
+ assert _view(x) == [("glasses", "자외선", "6 · 높음", "warn")]
+ assert _view(HeroInput(now=NOW, night=False, air=AirGrade.GOOD, uv=2.0, temp_min=13, temp_max=23)) == [("coldwind", "일교차 10°", "아침엔 겉옷", "normal")]
def test_rain_comes_first():
@@ -30,12 +31,12 @@ def test_rain_later_today_and_no_rain_today():
def test_bad_air_beats_uv_and_wears_mask():
x = HeroInput(now=NOW, night=False, air=AirGrade.VERY_BAD, uv=7.2)
- assert _view(x) == [("mask", "미세먼지", "매우나쁨", "warn"), ("glasses", "자외선", "7 · 높음", "warn")]
+ assert _view(x) == [("mask", "미세먼지", "매우나쁨", "warn")]
-def test_summer_night_muggy_then_moon_and_no_card_for_no_rain():
- x = HeroInput(now=NOW.replace(hour=21), night=True, uv=0.0, temp=28, feels=31, discomfort=80, moon="보름달")
- assert _view(x) == [("muggy", "불쾌지수", "80 · 매우 높음", "warn"), ("moon", "오늘 밤 달", "보름달", "normal")]
+def test_night_without_alert_shows_moon_and_no_card_for_no_rain():
+ x = HeroInput(now=NOW.replace(hour=21), night=True, uv=0.0, temp=28, feels=31, moon="보름달")
+ assert _view(x) == [("moon", "오늘 밤 달", "보름달", "normal")]
def test_one_coldwind_card_only():
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index 90127a9..6971d57 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -561,8 +561,16 @@ export type Hero = {
* Feels C
*/
feels_c?: number | null;
+ /**
+ * Humidity
+ *
+ * 지금 습도 %. 히어로에 늘 보인다
+ */
+ humidity?: number | null;
/**
* Discomfort
+ *
+ * 지금 불쾌지수. 히어로에 늘 보인다
*/
discomfort?: number | null;
/**
@@ -601,7 +609,7 @@ export type Hero = {
/**
* Stats
*
- * 히어로 두 칸. 지금 챙길 것(비·미세먼지·자외선·일교차·체감·불쾌지수) 먼저
+ * 히어로 상황 칸 1개. 지금 챙길 것(비·미세먼지·자외선·일교차·체감) 먼저
*/
stats?: Array;
};
diff --git a/frontend/src/b/TodayPage.tsx b/frontend/src/b/TodayPage.tsx
index 584fca8..18ff165 100644
--- a/frontend/src/b/TodayPage.tsx
+++ b/frontend/src/b/TodayPage.tsx
@@ -31,7 +31,8 @@ const PREVIEW: Record
}
// 히어로 칸을 받아 오는 동안 자리만 잡아 둔다
-const STAT_HOLD = ['a', 'b']
+const STAT_HOLD = ['a']
+const MUGGY = 75 // 불쾌지수 이 이상이면 경고 색
const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }))
// 별똥별 셋: 위치·길이·주기를 엇갈려 하나씩 떨어지게
@@ -131,9 +132,13 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
- {/* 기온 + 서버가 고른 챙길 것(비·미세먼지·자외선·일교차 등)을 한 줄 세 칸으로. 휴대폰에서 두 줄로 넘치지 않게 칸 안에서 위아래로 */}
+ {/* 기온·습도·불쾌지수 + 서버가 고른 챙길 것(비·미세먼지·자외선·일교차 등) 한 칸을 한 줄 네 칸으로. 휴대폰에서 두 줄로 넘치지 않게 칸 안에서 위아래로 */}
{heroVal(tempLoad, tempChip, 'w-12')}
+ {heroVal(feedLoad, hero?.humidity != null ? `${hero.humidity}%` : null, 'w-10')}
+ = MUGGY ? 'warn' : 'normal'}>
+ {heroVal(feedLoad, hero?.discomfort != null ? `${hero.discomfort} ${hero.discomfort_label ?? ''}`.trim() : null, 'w-10')}
+
{hero?.stats?.length
? hero.stats.map((s) => (
From fb47f59d5789691c37354675e1aae3a7cab39469 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 08:49:59 +0900
Subject: [PATCH 08/30] =?UTF-8?q?feat:=20=EB=8B=AC=20'=EB=B0=9D=EA=B8=B0?=
=?UTF-8?q?=20%'=20=EB=8C=80=EC=8B=A0=20=EB=AA=A8=EC=96=91=20+=20=EC=9E=98?=
=?UTF-8?q?=20=EB=B3=B4=EC=9D=B4=EB=8A=94=EC=A7=80(=EA=B5=AC=EB=A6=84?=
=?UTF-8?q?=C2=B7=EB=9C=A8=EA=B3=A0=20=EC=A7=80=EB=8A=94=20=EC=8B=9C?=
=?UTF-8?q?=EA=B0=81),=20=EB=8B=AC=20=EB=AA=A8=EC=96=91=EC=9D=84=20?=
=?UTF-8?q?=EC=8B=A4=EC=A0=9C=20=ED=95=B4=C2=B7=EB=8B=AC=20=EC=9C=84?=
=?UTF-8?q?=EC=B9=98=EB=A1=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 4 +-
backend/router/v1/feed/protocol.py | 2 +-
backend/services/calc/index_calc.py | 3 +-
backend/services/calc/moon.py | 109 ++++++++++++++++++++++++++--
backend/services/feed_service.py | 47 ++++++++----
backend/services/index_service.py | 6 +-
backend/tests/test_moon.py | 41 ++++++++++-
docs/점수_계산식.md | 24 +++++-
8 files changed, 204 insertions(+), 32 deletions(-)
diff --git a/TODO.md b/TODO.md
index b880681..cbb1b63 100644
--- a/TODO.md
+++ b/TODO.md
@@ -136,7 +136,7 @@
| [ ] | 각 문서: 강풍 특보 조건이 "wind 특보가 있으면"으로 찍힘 (등산·골프·낚시각) | 각 늘리기 중 발견 (10/8) | `backend/scripts/gen_gak_doc.py` |
| [ ] | 각 문서: "한눈에 보기" 표에 자외선·햇빛·가시거리 비중이 빠져 합이 100%가 안 됨 (등산·드라이브·물놀이각) | 각 늘리기 중 발견 (10/8) | `backend/scripts/gen_gak_doc.py` |
| [x] | 각 중요도: 새 각 7개 제안 — 드라이브 상 / 골프·낚시·물놀이 중 / 집콕·연날리기·김장 하 | 각 늘리기 (10/8) | `backend/seed/index_definition.json` |
-| [ ] | `tests/test_sky_api.py` 2개가 09시 직전(08:58 KST)에 실패 — 시간대 경계 의존, 재실행 시 통과 | 계절 사진 작업 중 발견 (10/8) | `backend/tests/test_sky_api.py` |
+| [ ] | `tests/test_sky_api.py` 2개가 09시 직전(08:45~08:58 KST)에 실패 — 시간대 경계 의존, 재실행 시 통과 | 계절 사진 작업 중 발견 (10/8) | `backend/tests/test_sky_api.py` |
| [ ] | 개인정보처리방침·이용약관 모달 (출시 후로 미룸) — `feat/legal` 브랜치(f6ddc67)에 구현 완료, 병합 전. 남은 것: `OPERATOR` 자리표시(회사명·대표자·사업자번호·주소·문의 이메일·보호책임자·호스팅 업체·로그 보유 기간), 탈퇴 기능 없음, 위치 좌표가 nginx 접속 로그에 남음, 만 14세 미만 확인 없음, 약관 열면 가입 입력값 사라짐, 위치정보법 신고 대상 법무 확인 | 사용자 결정 (10/8) | `frontend/src/b/legal/`, `frontend/src/b/Sheets.tsx` |
| [x] | 좋아요·댓글이 전국 공통 — 포스트가 (날짜, 자리) 하나로 전국에 하나뿐이라, 구마다 내용이 다른 카드(오늘 날씨·각 1~3위·노을·미세먼지·행사)도 댓글·좋아요를 전국이 같이 씀. 예: 강남의 "1위 산책각"과 부산의 "1위 빨래각"이 같은 댓글창. 안: 지역 데이터 카드만 시도(17) 단위로 나누고 계절·상식·명언은 전국 공통 유지 | 사용자 질문 (10/8) | `backend/postgres-init/init.sql` (`uq_post_feed`), `backend/services/feed_service.py` (`build_day`, `_gak`) |
| [ ] | **[결정 필요]** 포스트 시도 단위가 17이 아니라 16 — `region.code` 앞 2자리에서 광주·전남이 둘 다 `12`(전남광주통합특별시)라 같은 댓글창을 씀. 그대로 둘지, 이름 앞머리로 광주·전남을 나눌지 | 포스트 시도 나누기 (10/8) | `backend/services/feed_service.py` (`sido_of`), `backend/seed/region.csv` |
@@ -144,7 +144,7 @@
| [x] | 전체 날씨 점수 기준 강화 — 100점은 '1년에 하루' 수준으로만 → 각과 같은 계산에 기준만 좁힘(체감 21±0.5°·습도 45~55%·해 90%↑·바람 1m/s↓·초미세먼지 10↓, 사용자 결정 '기준만 좁히기'). 실제 연 몇 번 나오는지는 미확인 (`docs/점수_계산식.md` 3) | 10/8 회의 결정 | `backend/services/index_service.py:203` |
| [x] | 각 점수를 아침·낮·저녁·밤 시간대별로 → 지금 구간 점수로 순위, 안 겹치는 각은 순위·피드에서 빼고 스토리·전체엔 '지금 아님'. 히어로는 '지금 날씨 점수'(지금 구간). 운영 DB에 `index_score.slots` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 10/8 회의 결정 | `backend/services/calc/index_calc.py:297` |
| [x] | 히어로에 습도·불쾌지수 항상 표시 → 4칸(지금·습도·불쾌지수·상황 1칸, 사용자 결정). 불쾌지수 75 이상이면 경고 색, 상황 칸 후보에서 불쾌지수 뺌 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
-| [ ] | 달 '밝기 %' 정의(밝기인지 보이는 면적인지) + 구름·달 모양 반영 산정 로직 | 10/8 회의 | `backend/services/calc/moon.py` |
+| [x] | 달: '밝기 %' 표시 뺌 → 모양 + 잘 보이는지(구름·뜨고 지는 시각). 모양은 실제 해·달 황경 차이로(예전 계산은 보름을 반나절 일찍 판정). 별보기각은 빛나는 면 × 떠 있는 비율 (사용자 결정) | 10/8 회의 | `backend/services/calc/moon.py` |
| [x] | 노을: 점수 강조(히어로에 점수 크게) + 골든아워·블루아워 설명. 결론은 다음에 오는 것(해 뜨기 전·밤엔 일출, 그 사이엔 노을)으로, 피드 노을 카드도 같이 (사용자 결정 '각·노을도 지금 기준') | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
| [ ] | 주말 예보 UI 개선 — 회의에서 구체 내용 없음 | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
| [ ] | AEO·SEO 메타데이터 + 구글·네이버 검색 등록 (금일 핵심 업무), 넣은 태그·키워드 정의서 작성, 매시간 갱신 콘텐츠 노출 방식 정리 → 대표 보고. 도메인은 별도 유지 | 10/8 회의 결정 | `frontend/index.html`, `docs/` |
diff --git a/backend/router/v1/feed/protocol.py b/backend/router/v1/feed/protocol.py
index f5d3d74..667ef6c 100644
--- a/backend/router/v1/feed/protocol.py
+++ b/backend/router/v1/feed/protocol.py
@@ -155,7 +155,7 @@ class Hero(WebPacketProtocol):
top1: Optional[TopIndex] = None
bubble: Optional[str] = None
moon_name: Optional[str] = Field(default=None, description="오늘 밤 달 모양: 삭·초승달·상현달·차오르는 달·보름달·기우는 달·하현달·그믐달")
- moon_pct: Optional[int] = Field(default=None, description="달이 밝게 보이는 비율 0~100")
+ moon_pct: Optional[int] = Field(default=None, description="달에서 빛나는 면의 비율 0~100 (모양 그림용, 밝기 아님)")
stats: list[HeroStat] = Field(default_factory=list, description="히어로 상황 칸 1개. 지금 챙길 것(비·미세먼지·자외선·일교차·체감) 먼저")
diff --git a/backend/services/calc/index_calc.py b/backend/services/calc/index_calc.py
index 80e8978..5416f66 100644
--- a/backend/services/calc/index_calc.py
+++ b/backend/services/calc/index_calc.py
@@ -54,6 +54,7 @@ class Context:
sunset_score: Optional[int]
wind_warning: bool
lookahead_rain_prob: int
+ moon_note: str = "" # 별보기각 근거 문구: 그날 밤 달 모양·보이는 시간
@dataclass(frozen=True)
@@ -197,7 +198,7 @@ def time_score(rule: dict, ctx: Context) -> tuple[int, str]:
v = rule.get(key, rule.get("default", 100))
return _clamp(v), f"{_WEEKDAY_KO[ctx.day.weekday()]}요일{' 공휴일' if ctx.is_holiday else ''}"
if kind == "moon":
- return _clamp(20 + 80 * (1 - ctx.moon)), f"달 밝기 {round(ctx.moon * 100)}%"
+ return _clamp(20 + 80 * (1 - ctx.moon)), ctx.moon_note or f"달이 비추는 정도 {round(ctx.moon * 100)}%"
if kind == "sunset_score":
return (ctx.sunset_score if ctx.sunset_score is not None else _UNKNOWN), (
f"노을 점수 {ctx.sunset_score}" if ctx.sunset_score is not None else f"노을 점수 계산 전이라 {_UNKNOWN}점으로 둬요"
diff --git a/backend/services/calc/moon.py b/backend/services/calc/moon.py
index 84e9d12..cf4b140 100644
--- a/backend/services/calc/moon.py
+++ b/backend/services/calc/moon.py
@@ -1,5 +1,9 @@
import math
-from datetime import datetime, timedelta, timezone
+from dataclasses import dataclass
+from datetime import date, datetime, time, timedelta, timezone
+from typing import Optional
+
+from common.utils.kma_time import KST
_SYNODIC_DAYS = 29.530588
_KNOWN_NEW_MOON = datetime(2000, 1, 6, 18, 14, tzinfo=timezone.utc)
@@ -11,10 +15,12 @@ def illumination(at: datetime) -> float:
def _fraction(at: datetime) -> float:
- """직전 삭에서 다음 삭까지 얼마나 지났는지 0~1. 앞뒤 삭은 실제 시각(nearest)으로 잡는다."""
- near = nearest(at, False)
- prev, nxt = (near, nearest(near + timedelta(days=_SYNODIC_DAYS), False)) if near <= at else (nearest(near - timedelta(days=_SYNODIC_DAYS), False), near)
- return (at - prev) / (nxt - prev)
+ """달이 해보다 황경으로 얼마나 앞섰는지 0~1 (0 삭, 0.5 보름). 실제 위치로 보므로 보름·삭 시각과 맞는다."""
+ d = _days(at)
+ t = d / 36525
+ m = math.radians(357.52911 + 35999.05029 * t)
+ sun = 280.46646 + 36000.76983 * t + 1.914602 * math.sin(m) + 0.019993 * math.sin(2 * m)
+ return ((math.degrees(_ecliptic(d)[0]) - sun) % 360) / 360
# 달 모양 이름. 차오르는 비율(0 삭 → 0.5 보름 → 1 삭) 구간마다
@@ -51,3 +57,96 @@ def nearest(at: datetime, full: bool) -> datetime:
offset = 0.5 if full else 0.0
k = round((at - _KNOWN_NEW_MOON).total_seconds() / 86400 / _SYNODIC_DAYS - offset) + offset
return min((_true_phase(k + dk, full) for dk in (-1, 0, 1)), key=lambda x: abs(x - at))
+
+
+_HORIZON = -0.83 # 달 윗면이 지평선에 닿는 고도 (대기 굴절·반지름 포함, 지표에서 본 고도 기준)
+_NIGHT = (19, 29) # '오늘 밤': 19시~다음 날 5시
+_STEP = timedelta(minutes=10)
+
+
+def _days(at: datetime) -> float:
+ return (at - datetime(2000, 1, 1, 12, tzinfo=timezone.utc)).total_seconds() / 86400
+
+
+def _ecliptic(d: float) -> tuple[float, float, float]:
+ """2000-01-01 12시(UTC)부터 d 일 뒤 달의 황경·황위(라디안)와 거리(km). Meeus 47장 주요 항만 쓴 간이식, 오차 0.5° 안팎."""
+ t = d / 36525
+ r, s, c = math.radians, math.sin, math.cos
+ lp = 218.3164477 + 481267.88123421 * t
+ dd = r(297.8501921 + 445267.1114034 * t)
+ m = r(357.5291092 + 35999.0502909 * t)
+ mp = r(134.9633964 + 477198.8675055 * t)
+ f = r(93.2720950 + 483202.0175233 * t)
+ lam = r(lp + 6.289 * s(mp) + 1.274 * s(2 * dd - mp) + 0.658 * s(2 * dd) + 0.214 * s(2 * mp) - 0.186 * s(m) - 0.114 * s(2 * f))
+ beta = r(5.128 * s(f) + 0.281 * s(mp + f) + 0.278 * s(mp - f) + 0.173 * s(2 * dd - f))
+ dist_km = 385001 - 20905 * c(mp) - 3699 * c(2 * dd - mp) - 2956 * c(2 * dd)
+ return lam, beta, dist_km
+
+
+def altitude(at: datetime, lat: float, lon: float) -> float:
+ """그 시각 그 자리에서 본 달 고도(도). 뜨고 지는 시각은 몇 분 차이."""
+ d = _days(at)
+ r, s, c = math.radians, math.sin, math.cos
+ lam, beta, dist_km = _ecliptic(d)
+ eps = r(23.439 - 0.0000004 * d)
+ ra = math.atan2(s(lam) * c(eps) - math.tan(beta) * s(eps), c(lam))
+ dec = math.asin(s(beta) * c(eps) + c(beta) * s(eps) * s(lam))
+ ha = r(280.46061837 + 360.98564736629 * d + lon) - ra
+ phi = r(lat)
+ alt = math.asin(s(phi) * s(dec) + c(phi) * c(dec) * c(ha))
+ return math.degrees(alt - math.asin(6378.14 / dist_km) * c(alt))
+
+
+@dataclass(frozen=True)
+class MoonNight:
+ """그날 밤(19시~다음 날 5시) 달. lit 는 빛나는 면의 비율(모양), 밝기가 아니다."""
+ name: str
+ lit: float
+ rise_at: Optional[datetime] # 밤 사이에 뜨면 그 시각 (저녁부터 떠 있으면 None)
+ set_at: Optional[datetime] # 밤 사이에 지면 그 시각 (새벽까지 떠 있으면 None)
+ up_hours: tuple[int, ...] # 달이 떠 있는 시각 (19~28, 24 이상은 다음 날)
+
+
+def night(day: date, lat: float, lon: float) -> MoonNight:
+ start = datetime.combine(day, time(0), tzinfo=KST)
+ mid = start + timedelta(hours=23)
+ at, end = start + timedelta(hours=_NIGHT[0]), start + timedelta(hours=_NIGHT[1])
+ prev = altitude(at, lat, lon) > _HORIZON
+ rise_at = set_at = None
+ ups: set[int] = set()
+ while at < end:
+ up = altitude(at, lat, lon) > _HORIZON
+ if up and not prev and rise_at is None:
+ rise_at = at
+ if prev and not up and set_at is None:
+ set_at = at
+ if up:
+ ups.add(int((at - start).total_seconds() // 3600))
+ prev = up
+ at += _STEP
+ return MoonNight(name=phase_name(mid), lit=illumination(mid), rise_at=rise_at, set_at=set_at, up_hours=tuple(sorted(ups)))
+
+
+def up_ratio(m: MoonNight, hours: range) -> float:
+ """hours(19~28 기준 시각) 중 달이 떠 있는 비율."""
+ return sum(h in m.up_hours for h in hours) / len(hours)
+
+
+def view_line(m: MoonNight, cloudy: Optional[float]) -> str:
+ """오늘 밤 달이 잘 보이는지 한 마디. cloudy 는 달이 떠 있는 동안 흐린 정도 0~1 (모르면 None)."""
+ if m.lit < 0.03 or not m.up_hours:
+ return "달이 안 보여요"
+ if m.rise_at is not None and m.rise_at.hour not in range(19, 22):
+ return f"{_clock(m.rise_at)}에 떠요"
+ if cloudy is not None and cloudy >= 0.6:
+ return "구름에 가려요"
+ if cloudy is not None and cloudy >= 0.3:
+ return "구름 사이로 보여요"
+ if m.set_at is not None:
+ return f"{_clock(m.set_at)}까지 보여요"
+ return "밤새 잘 보여요"
+
+
+def _clock(at: datetime) -> str:
+ h = at.astimezone(KST).hour
+ return f"{'새벽' if h < 6 else '밤' if h >= 21 or h == 0 else '저녁'} {h % 12 or 12}시"
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index a84a49e..2831cb6 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -27,7 +27,7 @@ from services.air_service import GRADE_LABEL as AIR_GRADE_LABEL
from services.air_service import pm10_grade, pm25_grade
from services.calc.day_slot import NIGHT_AFTER_SUNSET, slot_of
from services.calc.index_calc import rank_score
-from services.calc.moon import illumination, nearest, phase_name
+from services.calc.moon import MoonNight, nearest, night, view_line
from services.calc.sky_score import GRADE_LABEL, SITUATION_LINE
from services.calc.sun import sun_times
from services.hero_stats import UV_HIGH, HeroInput, hero_stats, uv_label
@@ -134,7 +134,9 @@ def _discomfort_label(v: int) -> str:
return "쾌적" if v < 68 else "보통" if v < 75 else "불쾌" if v < 80 else "매우 불쾌"
-def _hero_input(now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: Optional[NowWeather], today: Optional[TodayWeather], uv: Optional[float]) -> HeroInput:
+def _hero_input(
+ now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: Optional[NowWeather], today: Optional[TodayWeather], uv: Optional[float], moon: Optional[str],
+) -> HeroInput:
temps = [float(x.row.temp_c) for x in today.slots if x.row] if today else []
rainy = [h for h in now_w.rain_hours if h.rain_type is not RainType.NONE] if now_w else []
ahead = [x for x in today.slots if x.row and x.at > now] if today else []
@@ -145,7 +147,7 @@ def _hero_input(now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: O
air=AirGrade(now_w.air.grade) if now_w and now_w.air and now_w.air.grade is not None else None, uv=uv,
temp_min=min(temps, default=None), temp_max=max(temps, default=None),
temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None,
- moon=phase_name(_tonight(now)),
+ moon=moon,
)
@@ -375,7 +377,7 @@ class FeedService:
items = board.items if board else []
feed = Res_Feed(
region_code=region.code, region_name=region.name, slot=slot,
- hero=self._hero(now, slot, hourly[0] if hourly else None, now_w, board, today, await self._uv(region.code, hour)),
+ hero=self._hero(now, slot, hourly[0] if hourly else None, now_w, board, today, await self._uv(region.code, hour), _moon_view(region, now, hourly or [])),
stories=[_top(i) for i in items], posts=arrange(cards, slot, now, sunset_at, has_warning, f"{day}:{region.code}"),
bands=Bands(
events=[BandEvent(event_id=e.event.event_id, name=e.event.name, status_label=e.status_label, icon=e.event.icon,
@@ -422,7 +424,7 @@ class FeedService:
return float(rows[0].uv_index)
def _hero(self, now: datetime, slot: str, cur: Optional[WeatherHourly], now_w: Optional[NowWeather], board: Optional[IndexBoard],
- today: Optional[TodayWeather] = None, uv: Optional[float] = None) -> Hero:
+ today: Optional[TodayWeather] = None, uv: Optional[float] = None, moon: Optional[tuple[MoonNight, str]] = None) -> Hero:
top = board.ranked[0] if board and board.ranked else None
bubble = None
if top is not None:
@@ -434,8 +436,9 @@ class FeedService:
discomfort=cur.discomfort_index if cur else None, discomfort_label=_discomfort_label(cur.discomfort_index) if cur else None,
rain_2h_text=now_w.rain_2h_text if now_w else None, will_rain_2h=now_w.will_rain_2h if now_w else None,
weather_score=board.weather_score if board else None, top1=_top(top) if top else None, bubble=bubble,
- moon_name=phase_name(_tonight(now)), moon_pct=round(illumination(_tonight(now)) * 100),
- stats=[HeroStat(icon=x.icon, label=x.label, value=x.value, tone=x.tone) for x in hero_stats(_hero_input(now, slot, cur, now_w, today, uv))],
+ moon_name=moon[0].name if moon else None, moon_pct=round(moon[0].lit * 100) if moon else None,
+ stats=[HeroStat(icon=x.icon, label=x.label, value=x.value, tone=x.tone)
+ for x in hero_stats(_hero_input(now, slot, cur, now_w, today, uv, f"{moon[0].name}, {moon[1]}" if moon else None))],
)
@staticmethod
@@ -511,24 +514,25 @@ class FeedService:
return None
def _moon(self, base: dict, c: "_Ctx") -> PostData:
- """오늘 밤(정오~다음 날 정오)에 보름이나 삭이 있으면 그 이야기를, 아니면 달 모양·밝기와 다음 보름. 피드 아래쪽에 둔다."""
+ """오늘 밤(정오~다음 날 정오)에 보름이나 삭이 있으면 그 이야기를, 아니면 달 모양·잘 보이는지와 다음 보름. 피드 아래쪽에 둔다."""
tonight = _tonight(c.now)
+ m, view = _moon_view(c.region, c.now, c.hourly)
start = tonight.replace(hour=12)
full, new = nearest(tonight, True).astimezone(KST), nearest(tonight, False).astimezone(KST)
at, is_full = (full, True) if start <= full < start + timedelta(days=1) else (new, False) if start <= new < start + timedelta(days=1) else (None, False)
row = next((h for h in c.hourly if h.forecast_at.astimezone(KST) == tonight), None)
sky = Sky(row.sky) if row is not None else None
- rows = [Row(label="밤 하늘", value=_MOON_SKY[sky])] if sky is not None else []
+ rows = [Row(label=label, value=_clock_word(t)) for label, t in (("달 뜸", m.rise_at), ("달 짐", m.set_at)) if t is not None]
eyebrow = f"오늘 밤 달 · {c.region.short_name}"
if at is None:
- name, pct = phase_name(tonight), round(illumination(tonight) * 100)
+ name = m.name
nxt = nearest(tonight + timedelta(days=15), True) if full < tonight else full
nxt = nxt.astimezone(KST)
waxing = name in ("초승달", "상현달", "차오르는 달")
caption = ("구름이 많아 달은 숨바꼭질해요." if sky is Sky.CLOUDY
else "하루하루 차오르는 중이에요. 보름까지 같이 세어 봐요 🌙" if waxing else "조금씩 기우는 중이에요. 그만큼 별은 더 잘 보여요 ✨")
return PostData(**base, title=f"오늘 밤 {name}", icon="moon", caption=caption,
- slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=f"오늘 밤은 {name},\n밝기 {pct}%", icon="moon",
+ slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=f"오늘 밤은 {name},\n{view}", icon="moon",
rows=[*rows, Row(label="다음 보름", value=f"{nxt.month}.{nxt.day:02d} ({_WEEKDAY_KO[nxt.weekday()]})")])],
share_messages=[f"오늘 밤은 {name}이래 🌙"])
when = f"{'내일 ' if at.date() > tonight.date() else ''}{at:%H:%M}"
@@ -536,14 +540,14 @@ class FeedService:
line = f"오늘 밤 보름달,\n{when}에 가장 둥글어요"
caption = "구름 사이로 잠깐씩 보일 수 있어요." if sky is Sky.CLOUDY else "소원 빌기 딱 좋은 밤이에요 🌕"
return PostData(**base, title="오늘 밤 보름달", icon="moon", caption=caption,
- slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=line, icon="moon", rows=[Row(label="달 밝기", value="100%"), *rows])],
+ slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=line, icon="moon", rows=[Row(label="보이는지", value=view), *rows])],
share_messages=["오늘 밤 보름달이래 🌕 같이 볼래?"])
stars = next((i for i in (c.board.items if c.board else []) if i.definition.code == "stars"), None)
if stars is not None:
rows.append(Row(label="별보기각", value=f"{stars.score.score}점"))
caption = "구름이 많아 별은 아쉬워요." if sky is Sky.CLOUDY else "불빛 적은 곳으로 조금만 나가 봐요 ✨"
return PostData(**base, title="오늘 밤 달 없는 밤", icon="moon", caption=caption,
- slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line="달이 숨는 밤,\n별이 제일 잘 보여요", icon="moon", rows=[Row(label="달 밝기", value="0%"), *rows])],
+ slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line="달이 숨는 밤,\n별이 제일 잘 보여요", icon="moon", rows=rows)],
share_messages=["오늘 밤 달이 없어서 별 보기 좋대 ✨"])
def _day_trip(self, base: dict, pick: TripPick, events: list[EventItem]) -> PostData:
@@ -747,7 +751,22 @@ def _event_caption(e: EventItem) -> str:
return "일정이 확정됐어요." if e.event.is_confirmed else "올해 정확한 일정은 공식 안내로 확인해 주세요."
-_MOON_SKY = {Sky.CLEAR: "맑음, 잘 보여요", Sky.PARTLY: "구름 조금, 사이사이 보여요", Sky.CLOUDY: "흐림, 가려질 수 있어요"}
+_CLOUDY = {Sky.CLEAR: 0.0, Sky.PARTLY: 0.5, Sky.CLOUDY: 1.0}
+
+
+def _moon_view(region: Region, now: datetime, hourly: list[WeatherHourly]) -> tuple[MoonNight, str]:
+ """오늘 밤 달과 잘 보이는지 한 마디. 구름은 달이 떠 있는 시각의 시간별 예보 하늘로 본다."""
+ day = feed_day(now.astimezone(KST))
+ m = night(day, float(region.lat), float(region.lon))
+ start = kst_midnight(day)
+ by_at = {h.forecast_at: h for h in hourly}
+ skies = [_CLOUDY[Sky(r.sky)] for h in m.up_hours if (r := by_at.get(start + timedelta(hours=h))) is not None]
+ return m, view_line(m, sum(skies) / len(skies) if skies else None)
+
+
+def _clock_word(at: datetime) -> str:
+ h = at.astimezone(KST).hour
+ return f"{'새벽' if h < 6 else '밤' if h >= 21 or h == 0 else '저녁'} {h % 12 or 12}시 {at.astimezone(KST).minute:02d}분"
def _tonight(now: datetime) -> datetime:
diff --git a/backend/services/index_service.py b/backend/services/index_service.py
index 3246232..0e8608e 100644
--- a/backend/services/index_service.py
+++ b/backend/services/index_service.py
@@ -18,7 +18,7 @@ from crud.week_crud import WeekCRUD
from services.air_service import GRADE_LABEL, AirService
from services.calc.day_slot import NIGHT_END_HOUR, SLOTS, slot_hours, slot_of
from services.calc.index_calc import AXES, Context, DayForecast, Hour, Result, estimate, evaluate, rank_score
-from services.calc.moon import illumination
+from services.calc.moon import night, up_ratio, view_line
from services.calc.sun import sun_times
from services.external.open_meteo import is_dark_slot
from services.warning_service import WarningService
@@ -27,6 +27,7 @@ from services.weather_service import WeatherService
# 시간별 예보로 늘 계산하는 날 수 (오늘~모레). 이번 주말은 시간별 예보가 없으면 중기예보로 예상 점수를 낸다.
DAYS = 3
_LOOKAHEAD_HOURS = (9, 18)
+_STARS_HOURS = range(21, 26) # 달빛이 별보기를 가리는지 보는 시각 (별보기각 시간대)
_WEEKDAY_KO = ("월", "화", "수", "목", "금", "토", "일")
# 메인 하늘 영역의 '지금 날씨 점수': 지금 구간(아침·낮·저녁·밤) 밖에 나가기 좋은 정도.
@@ -348,8 +349,9 @@ class IndexService:
return err, None
out = []
for day in days:
+ m = night(day, float(region.lat), float(region.lon))
ctx = Context(
- day=day, is_holiday=day in (holidays or set()), moon=illumination(datetime.combine(day, time(23), tzinfo=KST)),
+ day=day, is_holiday=day in (holidays or set()), moon=m.lit * up_ratio(m, _STARS_HOURS), moon_note=f"{m.name}, {view_line(m, None)}",
sunset_score=sunset.get(day), lookahead_rain_prob=0, **base_ctx,
)
for d in defs:
diff --git a/backend/tests/test_moon.py b/backend/tests/test_moon.py
index a686495..c8dd895 100644
--- a/backend/tests/test_moon.py
+++ b/backend/tests/test_moon.py
@@ -1,9 +1,9 @@
-from datetime import datetime, timezone
+from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
from common.enums import PostType
from common.utils.kma_time import KST
-from services.calc.moon import nearest, phase_name
+from services.calc.moon import altitude, nearest, night, phase_name, view_line
from services.feed_service import FeedService, _tonight
@@ -27,7 +27,7 @@ def test_tonight_follows_feed_day_starting_at_3am():
def _moon_post(now: datetime):
base = dict(post_id=1, post_type=PostType.MOON, like_count=0, comment_count=0, published_at=now)
- c = SimpleNamespace(now=now, region=SimpleNamespace(short_name="분당구"), hourly=[], board=None)
+ c = SimpleNamespace(now=now, region=SimpleNamespace(short_name="분당구", lat=37.38, lon=127.12), hourly=[], board=None)
return FeedService._moon(None, base, c)
@@ -38,3 +38,38 @@ def test_moon_post_every_night_with_full_and_new_moon_stories():
assert new.title == "오늘 밤 달 없는 밤"
plain = _moon_post(datetime(2025, 10, 4, 20, 0, tzinfo=KST)) # 보름 사흘 전
assert plain.title == "오늘 밤 차오르는 달" and plain.slides[0].rows[-1].label == "다음 보름" and plain.slides[0].rows[-1].value.startswith("10.07")
+
+
+SEOUL = (37.57, 126.98)
+
+
+def _night_of(at):
+ """그 시각과 23시가 가장 가까운 밤."""
+ return (at.astimezone(KST) - timedelta(hours=11)).date()
+
+
+def test_full_moon_is_up_all_night_and_highest_near_solar_midnight():
+ full = nearest(datetime(2026, 10, 25, tzinfo=KST), True)
+ day = _night_of(full)
+ m = night(day, *SEOUL)
+ assert m.name == "보름달" and set(range(20, 29)) <= set(m.up_hours)
+ start = datetime.combine(day, datetime.min.time(), tzinfo=KST)
+ peak = max((start + timedelta(hours=22, minutes=10 * i) for i in range(24)), key=lambda t: altitude(t, *SEOUL))
+ assert 23 <= (peak.hour if peak.hour >= 12 else peak.hour + 24) <= 25
+ assert view_line(m, 0.0) == "밤새 잘 보여요"
+ assert view_line(m, 0.8) == "구름에 가려요"
+
+
+def test_first_quarter_sets_around_midnight_and_new_moon_is_not_seen():
+ new = nearest(datetime(2026, 10, 12, tzinfo=KST), False)
+ quarter = night(_night_of(new + timedelta(days=7.4)), *SEOUL)
+ assert quarter.set_at is not None and quarter.set_at.astimezone(KST).hour in (21, 22, 23, 0, 1, 2)
+ assert view_line(quarter, 0.0).endswith("까지 보여요")
+ assert view_line(night(_night_of(new), *SEOUL), 0.0) == "달이 안 보여요"
+
+
+def test_waning_moon_rises_late():
+ full = nearest(datetime(2026, 10, 25, tzinfo=KST), True)
+ m = night(_night_of(full + timedelta(days=7.4)), *SEOUL)
+ assert m.rise_at is not None and m.rise_at.astimezone(KST).hour in (21, 22, 23, 0, 1, 2)
+ assert view_line(m, 0.0).endswith("에 떠요")
diff --git a/docs/점수_계산식.md b/docs/점수_계산식.md
index 4de80eb..6546fe3 100644
--- a/docs/점수_계산식.md
+++ b/docs/점수_계산식.md
@@ -9,7 +9,7 @@
| 나들이 점수 | 주말 탭 전국 순위, 당일치기 카드 | `backend/services/calc/index_calc.py` (`outing`) |
| 노을 점수·판정 | 노을 탭, 피드 노을 카드, 노을 순위 | `backend/services/calc/sky_score.py`, `backend/services/sky_service.py` |
| 노을 시각 | 노을 탭 시간표 | `backend/services/calc/sun.py`, `sky_score.py` (`best_times`) |
-| 달 밝기 | 밤 히어로 | `backend/services/calc/moon.py` |
+| 달 모양·잘 보이는지 | 밤 히어로, 달 포스트, 별보기각 | `backend/services/calc/moon.py` |
| 불쾌지수 | 히어로 칸 | `backend/services/calc/weather_calc.py` |
## 1. 공통 — 요소 점수와 섞는 법
@@ -150,10 +150,26 @@
일출 시간표는 블루아워(해 뜨기 전 해 고도 −6°) → 해 떠요 → 골든아워(해 고도 6°까지 올라오는 때)입니다. '가장 붉을 때'는 해 뜨기 10분 + (상층 구름 % ÷ 10)분 전입니다.
-## 8. 달 밝기
+## 8. 달 모양·잘 보이는지
-- **밝기 = (1 − cos(2π × 삭에서 지난 비율)) ÷ 2**. 0이면 그믐(안 보임), 1이면 보름입니다. 삭 시각은 Meeus 계산(오차 2분 안)입니다.
-- 달 모양에서 **빛나는 면의 비율**일 뿐, 구름·달 고도·월출 시각은 반영하지 않습니다.
+'달 밝기 N%'는 쓰지 않습니다. 초승달도 달 자체는 밝게 보이므로, 퍼센트는 밝기가 아니라 모양(빛나는 면)일 뿐이기 때문입니다.
+
+- **모양**: 달과 해의 황경 차이(0° 삭 → 180° 보름)로 정합니다. 빛나는 면 = (1 − cos 황경 차이) ÷ 2, 모양 이름은 차이 구간으로(삭·초승달·상현달·차오르는 달·보름달·기우는 달·하현달·그믐달). 히어로 달 그림에 씁니다.
+- **뜨고 지는 시각**: 그날 19시~다음 날 5시를 10분 간격으로 달 고도(Meeus 간이식, 지표 기준)를 계산해 −0.83°를 넘나드는 때.
+- **잘 보이는지** (위에서부터 먼저 걸리는 것):
+
+| 조건 | 문구 |
+|---|---|
+| 빛나는 면 3% 미만이거나 밤새 안 뜸 | 달이 안 보여요 |
+| 저녁 7~9시 사이가 아니라 밤늦게 뜸 | 새벽 2시에 떠요 |
+| 달이 떠 있는 시각의 하늘이 흐림 쪽 (맑음 0 · 구름많음 0.5 · 흐림 1의 평균 0.6 이상) | 구름에 가려요 |
+| 같은 평균 0.3 이상 | 구름 사이로 보여요 |
+| 밤사이 짐 | 밤 11시까지 보여요 |
+| 그 밖 | 밤새 잘 보여요 |
+
+- 히어로 '오늘 밤 달' 칸: '모양, 잘 보이는지' (예: 상현달, 밤 11시까지 보여요).
+- 달 포스트: 모양 + 잘 보이는지 + 달 뜸·짐 시각.
+- 별보기각 '시간' 요소: 달이 비추는 정도 = 빛나는 면 × 21~26시 중 달이 떠 있는 비율, 점수 = 20 + 80 × (1 − 그 값). 근거 문구는 '모양, 잘 보이는지'(구름 제외).
## 9. 불쾌지수
From c0d53b87081a4e4b891502feaa51a2a7114cbf60 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 08:50:14 +0900
Subject: [PATCH 09/30] =?UTF-8?q?chore:=20API=20=ED=83=80=EC=9E=85=20?=
=?UTF-8?q?=EC=9E=AC=EC=83=9D=EC=84=B1=20=E2=80=94=20=EB=8B=AC=20=EB=AA=A8?=
=?UTF-8?q?=EC=96=91=20=EB=B9=84=EC=9C=A8=20=EC=84=A4=EB=AA=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/api/client/types.gen.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index 6971d57..59308c3 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -603,7 +603,7 @@ export type Hero = {
/**
* Moon Pct
*
- * 달이 밝게 보이는 비율 0~100
+ * 달에서 빛나는 면의 비율 0~100 (모양 그림용, 밝기 아님)
*/
moon_pct?: number | null;
/**
From a4bb2e98c864bc7d2aff571e8a5dfa4302e72ebb Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:02:10 +0900
Subject: [PATCH 10/30] =?UTF-8?q?docs:=20=ED=94=BC=EB=93=9C=20=EB=8F=99?=
=?UTF-8?q?=EC=9E=91=EB=B0=A9=EC=8B=9D=C2=B7QA=20=EC=B2=B4=ED=81=AC?=
=?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=EB=A5=BC=20=EC=A7=80=EA=B8=88=20?=
=?UTF-8?q?=EA=B5=AC=EA=B0=84=20=EC=A0=90=EC=88=98=C2=B7=ED=9E=88=EC=96=B4?=
=?UTF-8?q?=EB=A1=9C=204=EC=B9=B8=C2=B7=EC=9D=BC=EC=B6=9C=C2=B7=EB=8B=AC?=
=?UTF-8?q?=20=ED=91=9C=EC=8B=9C=EC=97=90=20=EB=A7=9E=EA=B2=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/QA_체크리스트.md | 21 ++++++++++++---------
docs/피드_동작방식.md | 14 +++++++-------
2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/docs/QA_체크리스트.md b/docs/QA_체크리스트.md
index f9926db..c9e2012 100644
--- a/docs/QA_체크리스트.md
+++ b/docs/QA_체크리스트.md
@@ -1,6 +1,6 @@
# 기능 QA 체크리스트 (휴대폰)
-아이폰 Safari와 안드로이드 Chrome에서 http://172.30.1.36:30040 에 들어가 위에서부터 따라 하며 체크합니다. 기대 결과는 `frontend/src/b/` 코드 기준이고, 확실하지 않은 동작은 "(확인)"을 붙였습니다.
+아이폰 Safari와 안드로이드 Chrome에서 http://<킹서버>:30040 에 들어가 위에서부터 따라 하며 체크합니다. 기대 결과는 `frontend/src/b/` 코드 기준이고, 확실하지 않은 동작은 "(확인)"을 붙였습니다.
## 0. 처음 들어가기
@@ -18,7 +18,7 @@
## 2. 오늘 탭: 히어로
- [ ] 시간대 버튼 지금 · 아침 · 낮 · 저녁 · 밤, 처음엔 "지금", 날짜 줄은 "M월 D일 요일 · HH:MM"
-- [ ] 해 안에 "오늘 날씨 점수"와 큰 숫자, 아래 칩 한 줄: 첫 칸 "지금 + 기온·하늘", 나머지는 챙길 것(비·미세먼지 등)
+- [ ] 해 안에 "지금 날씨 점수"와 큰 숫자, 아래 한 줄 네 칸: "지금 + 기온·하늘" · "습도 N%" · "불쾌지수 N 쾌적"(75 이상이면 경고 색) · 챙길 것 한 칸(비·미세먼지 등). 폰 너비에서 넘치지 않는다
- [ ] "아침" → 시계 07:40, 첫 칩 이름 "아침", 기온이 7시 예보 값 (낮 13:20 · 저녁 18:25 · 밤 22:10도 같은 방식)
- [ ] 저녁·밤 → 해 동그라미가 오늘 밤 달 모양으로 가려진다(달 정보가 있을 때), 밤은 캐릭터가 곰
- [ ] 말풍선 누름 → 1위 각의 계산 근거 시트
@@ -34,6 +34,7 @@
## 4. 오늘 탭: 각 줄·띠
- [ ] "오늘의 각" 동그라미 줄이 옆으로 밀리고, 1~3위 메달, 50점 미만은 회색 테두리, 누르면 계산 근거 시트
+- [ ] 지금 구간에 안 맞는 각(예: 아침의 야장각)은 줄 뒤쪽에 흐리게 "지금 아님", 메달 없음
- [ ] "전체 보기" → 각 탭
- [ ] 3번째 글 뒤 "이번 주 가까운 행사"(카드 → 주말·행사 탭), 6번째 뒤 "지금 뜨는 각 TOP 5"(카드 → 계산 근거), 9번째 뒤 "이번 주 계절 이야기"(카드 → 읽을거리)
- [ ] 글이 9개보다 적으면 남은 띠가 피드 맨 끝에 붙는다
@@ -45,7 +46,8 @@
- [ ] 2장 이상이면 오른쪽 위 "1/N", 밀면 숫자가 바뀐다. 1장짜리는 밀리지 않는다
- [ ] 오늘 날씨: 시간별 4칸(주황 막대 높이가 기온 비례), 저녁 칸 살구색·밤 칸 보라색
- [ ] 각: "오늘의 각 · N위", 큰 점수, "계산 근거 보기" → 계산 근거 시트
-- [ ] 노을: 노을 점수와 시각 칸들 / 주말 예보: 토·일 칸("비 N% · 일교차 N°") + 검은 팁 줄
+- [ ] 노을: 노을 점수와 시각 칸들 (해 뜨기 전·밤엔 "내일 일출"/"오늘 일출", 명소 장 없음)
+- [ ] 오늘 밤 달: "오늘 밤은 모양,\n잘 보이는지"(예: 구름에 가려요 · 새벽 2시에 떠요 · 밤 11시까지 보여요), 달 뜸·짐 시각 줄, "밝기 %"는 어디에도 없다 / 주말 예보: 토·일 칸("비 N% · 일교차 N°") + 검은 팁 줄
- [ ] 주말 플랜: 시간·아이콘·제목·설명 줄, 사진이 있으면 작은 사진과 맨 아래 "사진 출처"
- [ ] 행사·당일치기 사진 슬라이드: 사진 위 글자, 오른쪽 위 출처
- [ ] 점선 밑줄 장소 이름 → 네이버 지도 검색이 새 탭으로
@@ -87,18 +89,19 @@
## 9. 노을 탭
-- [ ] 히어로 "오늘 노을 · 지역", 큰 해 지는 시각, 하늘 상황 한 줄, 상황에 따라 색이 다르고 아래 동네 실루엣
-- [ ] 흰 카드: 결론 + 이유, "예보 모델 N개 중 M개가 같은 예보 · 노을 점수 N"
-- [ ] "언제 보면 좋을까" 세 시각(해 짐 점만 주황), 더 나은 날이 있을 때만 분홍 안내 상자
+- [ ] 히어로 "오늘 노을 · 지역"(해 뜨기 전·블루아워 뒤엔 "… 일출"), 큰 점수 + "점 · 등급", 그 아래 "HH:MM 해 져요(떠요) · 하늘 상황", 상황에 따라 색이 다르고 아래 동네 실루엣
+- [ ] 흰 카드: 결론 + 이유, "예보 모델 N개 중 M개가 같은 예보"
+- [ ] "언제 보면 좋을까" 세 시각(해 짐·뜸 점만 주황) + 아래 골든아워·블루아워 뜻 두 줄(일출이면 일출 기준 설명), 더 나은 날이 있을 때만 분홍 안내 상자
+- [ ] 일출일 땐 가까운 노을 명소가 안 나온다
- [ ] 가까운 노을 명소 최대 3곳("방향쪽" · "Nkm", 이름 → 네이버 지도), 전국 노을 순위 8곳(내 지역 흰 바탕 + "내 지역")
## 10. 각 탭
-- [ ] "오늘 1~3위" 부제 "M월 D일 기준 · 지역", 받침대 2위 · 1위(가장 크고 노란 바탕) · 3위, 누르면 계산 근거
+- [ ] "오늘 1~3위"(지금 구간 기준, 안 맞는 각 제외) 부제 "M월 D일 기준 · 지역", 받침대 2위 · 1위(가장 크고 노란 바탕) · 3위, 누르면 계산 근거
- [ ] 분야 칩 전체 · 밖에서 놀기 · 먹고 마시기 · 집안일 · 생활 고민 · 가을 각 → 3열 목록이 바뀐다
-- [ ] 목록 칸: 왼쪽 위 순위, 가을 핵심 각은 초록 "가을", 50점 미만 점수 회색
+- [ ] 목록 칸: 왼쪽 위 순위, 가을 핵심 각은 초록 "가을", 50점 미만 점수 회색, 지금 구간에 안 맞는 각은 맨 뒤 흐리게 "지금 아님"(순위 없음)
- [ ] 맨 아래 "각 점수는 어떻게 매길까?" → 읽을거리 시트
-- [ ] 계산 근거 시트: 제목 "N위 이름", 지금 구간 설명, 레이더(요소 3개 이상), 날짜별 추이("예상" 표시), 구간 목록, 요소별 막대·비중, 계산 방법
+- [ ] 계산 근거 시트: 제목 "N위 이름", 지금 구간 설명, 레이더(요소 3개 이상), 오늘 아침·낮·저녁·밤 4칸(지금 칸 강조, 안 겹치는 구간 '–'), 날짜별 추이("예상" 표시), 구간 목록, 요소별 막대·비중, 계산 방법
## 11. 주말·행사 탭
diff --git a/docs/피드_동작방식.md b/docs/피드_동작방식.md
index b297b78..1a752ed 100644
--- a/docs/피드_동작방식.md
+++ b/docs/피드_동작방식.md
@@ -35,7 +35,7 @@
| 1 | 오늘·내일 날씨 | | 오늘 예보가 있으면 |
| 2 | 생활 알림(특보) | | 그 구에 특보가 있을 때 |
| 3~5 | 오늘의 각 | 1·2·3위 | 각 점수가 있으면 |
-| 6 | 노을 | | 노을 계산이 있으면. 하늘 상황으로 말하고, 결론이 '쉬어요'(구름에 가려요·낮은 구름이 덮어요)면 한 줄 카드 |
+| 6 | 노을 | | 노을 탭 결론과 같은 것(해 뜨기 전·블루아워 뒤엔 일출, 그 사이엔 노을). 하늘 상황으로 말하고, 결론이 '쉬어요'(구름에 가려요·낮은 구름이 덮어요)면 한 줄 카드 |
| 7 | 내일 미리보기 | | 저녁·밤에만 |
| 8 | 주말 예보 | | 주말 예보가 있으면 |
| 9, 13, 14 | 가까운 행사 | 1·2·3번째 | 7일 안에 열리는 행사가 그만큼 있으면 |
@@ -45,7 +45,7 @@
| 15·16 | 주말 플랜 | 토·일 | 주말 예보가 있으면 |
| 17 | 미세먼지 | | 측정값이 3시간 안이면 |
| 18 | 당일치기 | | 1~2시간 거리 후보 도시 1위가 있으면 |
-| 19 | 오늘 밤 달 | | 늘 켜짐. 보름·삭인 밤이면 그 이야기, 아니면 달 모양·밝기·다음 보름 |
+| 19 | 오늘 밤 달 | | 늘 켜짐. 보름·삭인 밤이면 그 이야기, 아니면 달 모양·잘 보이는지(구름·뜨고 지는 시각)·다음 보름 |
## 2. 칸 채우기 (누가 열 때, 구마다)
@@ -95,7 +95,7 @@
**기본 순서 위에 덧붙는 규칙**
1. **특보가 있으면** 맨 위(히어로 바로 아래), 그다음 오늘·내일 날씨. 특보가 없으면 날씨가 맨 위.
2. **금요일 저녁**엔 주말 예보를 노을 바로 다음(2번째)으로 올린다.
-3. **저녁에 해가 진 뒤**엔 노을 카드가 내일 노을로 바뀌고, 맨 위에서 세 번째로 내려간다.
+3. **저녁에 해가 진 뒤**엔 노을 카드가 맨 위에서 세 번째로 내려가고, 블루아워가 끝나면 내일 일출 카드로 바뀐다.
4. **밤**엔 한 문장을 맨 끝으로.
5. **같은 종류가 붙으면** 뒤에서 다른 종류를 당겨 끼운다(각·각·각이 연달아 나오지 않게).
6. **행사 카드(최대 3장)**는 위 순서와 따로, "날짜+구"를 씨앗으로 고른 자리에 끼운다. 같은 날 같은 구는 시간대가 바뀌어도 늘 같은 몇 번째 자리에 들어간다.
@@ -107,13 +107,13 @@
- 각 점수와 순위 자체는 새 예보·미세먼지가 들어올 때 다시 계산되므로(하루 8번 예보 + 매시 미세먼지), 그때 캐시가 끝나면 1·2·3위가 바뀔 수 있다.
**히어로·띠의 순서**
-- 오늘의 각 줄(27개)과 띠의 각 순위(5개): 오늘 점수 높은 순.
-- 히어로 1위 각: 오늘 점수 1위.
+- 오늘의 각 줄(34개): 지금 구간(아침·낮·저녁·밤) 점수 높은 순. 각 시간대가 지금 구간과 안 겹치는 각은 맨 뒤에 '지금 아님'으로.
+- 띠의 각 순위(5개)·피드 각 카드 1~3위·히어로 1위 각: 지금 구간에 해당하는 각만, 지금 구간 점수 순.
- 띠의 행사: 30km 안 행사 중 시작일이 오늘과 가까운 순(같으면 가까운 거리 순) 4개. 계절 소식: 이번 주 글.
### 같이 만드는 것
-- 히어로: 지금 기온·체감, 불쾌지수, 날씨 점수, 1위 각, 말풍선, 오늘 밤 달 모양·밝기
-- 오늘의 각 줄: 27개 이름·점수·순위
+- 히어로: 지금 날씨 점수, 아래 네 칸(지금 기온·습도·불쾌지수·챙길 것 한 칸), 1위 각, 말풍선, 오늘 밤 달 모양·잘 보이는지
+- 오늘의 각 줄: 34개 이름·점수·순위 (지금 구간에 안 맞는 각은 '지금 아님')
- 띠: 행사 4개, 각 순위 5개, 계절 소식
## 3. 저장과 갱신
From fcf199031a3a2f2cc48eea99ab5ac242a3e82f04 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:02:18 +0900
Subject: [PATCH 11/30] =?UTF-8?q?docs:=20QA=20=EC=B2=B4=ED=81=AC=EB=A6=AC?=
=?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=8B=AC=20=ED=95=AD=EB=AA=A9=20=EC=A4=84?=
=?UTF-8?q?=20=EB=B0=94=EB=A1=9C=EC=9E=A1=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/QA_체크리스트.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/QA_체크리스트.md b/docs/QA_체크리스트.md
index c9e2012..c0c2310 100644
--- a/docs/QA_체크리스트.md
+++ b/docs/QA_체크리스트.md
@@ -46,8 +46,8 @@
- [ ] 2장 이상이면 오른쪽 위 "1/N", 밀면 숫자가 바뀐다. 1장짜리는 밀리지 않는다
- [ ] 오늘 날씨: 시간별 4칸(주황 막대 높이가 기온 비례), 저녁 칸 살구색·밤 칸 보라색
- [ ] 각: "오늘의 각 · N위", 큰 점수, "계산 근거 보기" → 계산 근거 시트
-- [ ] 노을: 노을 점수와 시각 칸들 (해 뜨기 전·밤엔 "내일 일출"/"오늘 일출", 명소 장 없음)
-- [ ] 오늘 밤 달: "오늘 밤은 모양,\n잘 보이는지"(예: 구름에 가려요 · 새벽 2시에 떠요 · 밤 11시까지 보여요), 달 뜸·짐 시각 줄, "밝기 %"는 어디에도 없다 / 주말 예보: 토·일 칸("비 N% · 일교차 N°") + 검은 팁 줄
+- [ ] 노을: 노을 점수와 시각 칸들 (해 뜨기 전·밤엔 "내일 일출"/"오늘 일출", 명소 장 없음) / 주말 예보: 토·일 칸("비 N% · 일교차 N°") + 검은 팁 줄
+- [ ] 오늘 밤 달: "오늘 밤은 (모양), (잘 보이는지)"(예: 구름에 가려요 · 새벽 2시에 떠요 · 밤 11시까지 보여요), 달 뜸·짐 시각 줄, "밝기 %"는 어디에도 없다
- [ ] 주말 플랜: 시간·아이콘·제목·설명 줄, 사진이 있으면 작은 사진과 맨 아래 "사진 출처"
- [ ] 행사·당일치기 사진 슬라이드: 사진 위 글자, 오른쪽 위 출처
- [ ] 점선 밑줄 장소 이름 → 네이버 지도 검색이 새 탭으로
From ef57a47e290001eb2d2e983458182c5a422bbc73 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:18:01 +0900
Subject: [PATCH 12/30] =?UTF-8?q?feat:=20=EC=A3=BC=EB=A7=90=20=EC=98=88?=
=?UTF-8?q?=EB=B3=B4=20=EC=B9=B4=EB=93=9C=EC=97=90=20=ED=86=A0=C2=B7?=
=?UTF-8?q?=EC=9D=BC=20=EB=8C=80=ED=91=9C=20=EA=B0=81=203=EA=B0=9C,=20?=
=?UTF-8?q?=EC=B9=B8=EC=9D=84=20=EC=A0=9C=EB=AA=A9=20=EC=95=84=EB=9E=98?=
=?UTF-8?q?=EB=A1=9C=20=EC=98=AC=EB=A0=A4=20=EA=B0=80=EC=9A=B4=EB=8D=B0=20?=
=?UTF-8?q?=EB=B9=88=20=EA=B3=B5=EA=B0=84=20=EC=97=86=EC=95=A0=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 2 +-
backend/router/v1/feed/protocol.py | 8 ++++++++
backend/services/feed_service.py | 12 ++++++++++--
frontend/src/api/client/index.ts | 2 +-
frontend/src/api/client/types.gen.ts | 28 ++++++++++++++++++++++++++++
frontend/src/b/Post.tsx | 17 +++++++++++++++--
6 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/TODO.md b/TODO.md
index cbb1b63..03dfe44 100644
--- a/TODO.md
+++ b/TODO.md
@@ -146,6 +146,6 @@
| [x] | 히어로에 습도·불쾌지수 항상 표시 → 4칸(지금·습도·불쾌지수·상황 1칸, 사용자 결정). 불쾌지수 75 이상이면 경고 색, 상황 칸 후보에서 불쾌지수 뺌 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
| [x] | 달: '밝기 %' 표시 뺌 → 모양 + 잘 보이는지(구름·뜨고 지는 시각). 모양은 실제 해·달 황경 차이로(예전 계산은 보름을 반나절 일찍 판정). 별보기각은 빛나는 면 × 떠 있는 비율 (사용자 결정) | 10/8 회의 | `backend/services/calc/moon.py` |
| [x] | 노을: 점수 강조(히어로에 점수 크게) + 골든아워·블루아워 설명. 결론은 다음에 오는 것(해 뜨기 전·밤엔 일출, 그 사이엔 노을)으로, 피드 노을 카드도 같이 (사용자 결정 '각·노을도 지금 기준') | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
-| [ ] | 주말 예보 UI 개선 — 회의에서 구체 내용 없음 | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
+| [x] | 주말 예보 UI 개선 → 피드 주말 예보 카드: 토·일 칸을 제목 바로 아래로(칸이 바닥에 붙어 가운데가 비어 오류처럼 보였음), 칸마다 '이날 할 만한 각' 3개 (사용자 의견) | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
| [ ] | AEO·SEO 메타데이터 + 구글·네이버 검색 등록 (금일 핵심 업무), 넣은 태그·키워드 정의서 작성, 매시간 갱신 콘텐츠 노출 방식 정리 → 대표 보고. 도메인은 별도 유지 | 10/8 회의 결정 | `frontend/index.html`, `docs/` |
| [ ] | `docs/콘텐츠_구현기획.md` 2-1의 오늘 날씨 점수 식이 예전 기준(기온 40·비 30·바람 15·미세먼지 15) — 새 기준은 `docs/점수_계산식.md` | 점수 계산식 정리 중 발견 (10/8) | `docs/콘텐츠_구현기획.md` |
diff --git a/backend/router/v1/feed/protocol.py b/backend/router/v1/feed/protocol.py
index 667ef6c..42c07a1 100644
--- a/backend/router/v1/feed/protocol.py
+++ b/backend/router/v1/feed/protocol.py
@@ -66,6 +66,13 @@ class SunsetSlide(WebPacketProtocol):
situation: Optional[SkySituation] = Field(default=None, description="하늘 상황. 앱이 카드 하늘 색을 고른다")
+class WeekGak(WebPacketProtocol):
+ index_id: int
+ name: str
+ icon: str
+ score: int
+
+
class WeekDay(WebPacketProtocol):
day: date
weekday: str
@@ -74,6 +81,7 @@ class WeekDay(WebPacketProtocol):
temp_min_c: Optional[float] = None
temp_max_c: Optional[float] = None
rain_prob: Optional[int] = None
+ gaks: list[WeekGak] = Field(default_factory=list, description="그날 대표 각 (점수 × 중요도 순 3개). 각 점수가 아직 없는 날은 비어 있음")
class WeekSlide(WebPacketProtocol):
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index 2831cb6..6b613f2 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -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))
diff --git a/frontend/src/api/client/index.ts b/frontend/src/api/client/index.ts
index 38fbfa9..bb70c7a 100644
--- a/frontend/src/api/client/index.ts
+++ b/frontend/src/api/client/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { addComment, deleteComment, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, listArticles, listComments, listEvents, listIndices, listPlaces, listRegions, listSaved, login, logout, me, nearestRegion, type Options, refresh, savePost, signup, unlikeComment, unlikePost, unsavePost, updateMe } from './sdk.gen';
-export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen';
+export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekGak, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen';
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index 59308c3..6f7d340 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -2694,6 +2694,34 @@ export type WeekDay = {
* Rain Prob
*/
rain_prob?: number | null;
+ /**
+ * Gaks
+ *
+ * 그날 대표 각 (점수 × 중요도 순 3개). 각 점수가 아직 없는 날은 비어 있음
+ */
+ gaks?: Array;
+};
+
+/**
+ * WeekGak
+ */
+export type WeekGak = {
+ /**
+ * Index Id
+ */
+ index_id: number;
+ /**
+ * Name
+ */
+ name: string;
+ /**
+ * Icon
+ */
+ icon: string;
+ /**
+ * Score
+ */
+ score: number;
};
/**
diff --git a/frontend/src/b/Post.tsx b/frontend/src/b/Post.tsx
index a30a5ef..580beed 100644
--- a/frontend/src/b/Post.tsx
+++ b/frontend/src/b/Post.tsx
@@ -153,7 +153,8 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
-
+ {/* 칸은 제목 바로 아래, 팁만 맨 아래로. 칸을 바닥에 붙이면 가운데가 비어 덜 그려진 화면처럼 보인다 */}
+
)
if (slide.kind === 'plan') {
From f4fe3e965ce381a21eb0d4db9d263a217c09d2fa Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:26:50 +0900
Subject: [PATCH 13/30] =?UTF-8?q?fix:=20=EB=8B=AC=EC=9D=B4=20=EC=95=88=20?=
=?UTF-8?q?=EB=B3=B4=EC=9D=BC=20=EB=95=8C=20=EC=9D=B4=EC=9C=A0=EB=A5=BC=20?=
=?UTF-8?q?=EB=B6=99=EC=97=AC=20=EB=A7=90=ED=95=98=EA=B8=B0(=EC=82=AD?=
=?UTF-8?q?=C2=B7=EC=9D=BC=EC=B0=8D=20=EC=A7=90=C2=B7=EB=8A=A6=EA=B2=8C=20?=
=?UTF-8?q?=EB=9C=B8=C2=B7=ED=9D=90=EB=A6=BC),=20=EB=8B=AC=20=ED=8F=AC?=
=?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=84=A4=EB=AA=85=EA=B8=80=EC=9D=84=20?=
=?UTF-8?q?=EB=B3=B8=EB=AC=B8=20=ED=8C=90=EC=A0=95=EC=97=90=20=EB=A7=9E?=
=?UTF-8?q?=EC=B6=94=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 1 +
backend/services/calc/moon.py | 13 ++++++++-----
backend/services/feed_service.py | 6 ++++--
backend/tests/test_moon.py | 10 +++++++---
docs/QA_체크리스트.md | 2 +-
docs/점수_계산식.md | 6 ++++--
6 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/TODO.md b/TODO.md
index 03dfe44..1b8214b 100644
--- a/TODO.md
+++ b/TODO.md
@@ -149,3 +149,4 @@
| [x] | 주말 예보 UI 개선 → 피드 주말 예보 카드: 토·일 칸을 제목 바로 아래로(칸이 바닥에 붙어 가운데가 비어 오류처럼 보였음), 칸마다 '이날 할 만한 각' 3개 (사용자 의견) | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
| [ ] | AEO·SEO 메타데이터 + 구글·네이버 검색 등록 (금일 핵심 업무), 넣은 태그·키워드 정의서 작성, 매시간 갱신 콘텐츠 노출 방식 정리 → 대표 보고. 도메인은 별도 유지 | 10/8 회의 결정 | `frontend/index.html`, `docs/` |
| [ ] | `docs/콘텐츠_구현기획.md` 2-1의 오늘 날씨 점수 식이 예전 기준(기온 40·비 30·바람 15·미세먼지 15) — 새 기준은 `docs/점수_계산식.md` | 점수 계산식 정리 중 발견 (10/8) | `docs/콘텐츠_구현기획.md` |
+| [ ] | **[결정 필요]** 각 순위가 점수 순이 아니라 보임 — 순위가 점수 × 중요도라 환기각 92점(하)이 5위, 골프각 89점이 3위, 빨래각 83점이 2위. 각 탭 받침대·스토리에서 높은 점수가 뒤에 있어 어색함. 점수를 순위대로 보여줄지, 중요도 가중을 줄일지 | 화면 직접 확인 중 발견 (10/12) | `backend/services/calc/index_calc.py` (`PRIORITY_WEIGHT`), `frontend/src/b/GakPage.tsx` |
diff --git a/backend/services/calc/moon.py b/backend/services/calc/moon.py
index cf4b140..040d4a1 100644
--- a/backend/services/calc/moon.py
+++ b/backend/services/calc/moon.py
@@ -102,6 +102,7 @@ class MoonNight:
"""그날 밤(19시~다음 날 5시) 달. lit 는 빛나는 면의 비율(모양), 밝기가 아니다."""
name: str
lit: float
+ waxing: bool # 삭 → 보름 사이 (해 진 뒤 서쪽 하늘에 있다가 지는 쪽)
rise_at: Optional[datetime] # 밤 사이에 뜨면 그 시각 (저녁부터 떠 있으면 None)
set_at: Optional[datetime] # 밤 사이에 지면 그 시각 (새벽까지 떠 있으면 None)
up_hours: tuple[int, ...] # 달이 떠 있는 시각 (19~28, 24 이상은 다음 날)
@@ -124,7 +125,7 @@ def night(day: date, lat: float, lon: float) -> MoonNight:
ups.add(int((at - start).total_seconds() // 3600))
prev = up
at += _STEP
- return MoonNight(name=phase_name(mid), lit=illumination(mid), rise_at=rise_at, set_at=set_at, up_hours=tuple(sorted(ups)))
+ return MoonNight(name=phase_name(mid), lit=illumination(mid), waxing=_fraction(mid) < 0.5, rise_at=rise_at, set_at=set_at, up_hours=tuple(sorted(ups)))
def up_ratio(m: MoonNight, hours: range) -> float:
@@ -133,13 +134,15 @@ def up_ratio(m: MoonNight, hours: range) -> float:
def view_line(m: MoonNight, cloudy: Optional[float]) -> str:
- """오늘 밤 달이 잘 보이는지 한 마디. cloudy 는 달이 떠 있는 동안 흐린 정도 0~1 (모르면 None)."""
- if m.lit < 0.03 or not m.up_hours:
- return "달이 안 보여요"
+ """오늘 밤 달이 잘 보이는지 한 마디. 안 보이면 왜인지까지. cloudy 는 달이 떠 있는 동안 흐린 정도 0~1 (모르면 None)."""
+ if m.lit < 0.03:
+ return "해와 같은 쪽에 있어 안 보여요"
+ if not m.up_hours:
+ return "해 진 뒤 곧 져서 밤엔 안 보여요" if m.waxing else "새벽 늦게 떠서 밤엔 안 보여요"
if m.rise_at is not None and m.rise_at.hour not in range(19, 22):
return f"{_clock(m.rise_at)}에 떠요"
if cloudy is not None and cloudy >= 0.6:
- return "구름에 가려요"
+ return "흐려서 구름에 가려요"
if cloudy is not None and cloudy >= 0.3:
return "구름 사이로 보여요"
if m.set_at is not None:
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index 6b613f2..4abc2cb 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -530,7 +530,9 @@ class FeedService:
nxt = nearest(tonight + timedelta(days=15), True) if full < tonight else full
nxt = nxt.astimezone(KST)
waxing = name in ("초승달", "상현달", "차오르는 달")
- caption = ("구름이 많아 달은 숨바꼭질해요." if sky is Sky.CLOUDY
+ # 본문(잘 보이는지)과 어긋나지 않게: 안 보이는 밤·흐린 밤은 그 이유에 맞춰서
+ caption = ("달이 없는 만큼 별은 더 잘 보여요 ✨" if "안 보여요" in view
+ else "구름 사이로 잠깐씩 보일 수도 있어요." if view.startswith("흐려서")
else "하루하루 차오르는 중이에요. 보름까지 같이 세어 봐요 🌙" if waxing else "조금씩 기우는 중이에요. 그만큼 별은 더 잘 보여요 ✨")
return PostData(**base, title=f"오늘 밤 {name}", icon="moon", caption=caption,
slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=f"오늘 밤은 {name},\n{view}", icon="moon",
@@ -539,7 +541,7 @@ class FeedService:
when = f"{'내일 ' if at.date() > tonight.date() else ''}{at:%H:%M}"
if is_full:
line = f"오늘 밤 보름달,\n{when}에 가장 둥글어요"
- caption = "구름 사이로 잠깐씩 보일 수 있어요." if sky is Sky.CLOUDY else "소원 빌기 딱 좋은 밤이에요 🌕"
+ caption = "구름 사이로 잠깐씩 보일 수 있어요." if view.startswith("흐려서") else "소원 빌기 딱 좋은 밤이에요 🌕"
return PostData(**base, title="오늘 밤 보름달", icon="moon", caption=caption,
slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=line, icon="moon", rows=[Row(label="보이는지", value=view), *rows])],
share_messages=["오늘 밤 보름달이래 🌕 같이 볼래?"])
diff --git a/backend/tests/test_moon.py b/backend/tests/test_moon.py
index c8dd895..7f3a4c7 100644
--- a/backend/tests/test_moon.py
+++ b/backend/tests/test_moon.py
@@ -1,9 +1,10 @@
+from dataclasses import replace
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
from common.enums import PostType
from common.utils.kma_time import KST
-from services.calc.moon import altitude, nearest, night, phase_name, view_line
+from services.calc.moon import MoonNight, altitude, nearest, night, phase_name, view_line
from services.feed_service import FeedService, _tonight
@@ -57,7 +58,7 @@ def test_full_moon_is_up_all_night_and_highest_near_solar_midnight():
peak = max((start + timedelta(hours=22, minutes=10 * i) for i in range(24)), key=lambda t: altitude(t, *SEOUL))
assert 23 <= (peak.hour if peak.hour >= 12 else peak.hour + 24) <= 25
assert view_line(m, 0.0) == "밤새 잘 보여요"
- assert view_line(m, 0.8) == "구름에 가려요"
+ assert view_line(m, 0.8) == "흐려서 구름에 가려요"
def test_first_quarter_sets_around_midnight_and_new_moon_is_not_seen():
@@ -65,7 +66,10 @@ def test_first_quarter_sets_around_midnight_and_new_moon_is_not_seen():
quarter = night(_night_of(new + timedelta(days=7.4)), *SEOUL)
assert quarter.set_at is not None and quarter.set_at.astimezone(KST).hour in (21, 22, 23, 0, 1, 2)
assert view_line(quarter, 0.0).endswith("까지 보여요")
- assert view_line(night(_night_of(new), *SEOUL), 0.0) == "달이 안 보여요"
+ assert view_line(night(_night_of(new), *SEOUL), 0.0) == "해와 같은 쪽에 있어 안 보여요"
+ hidden = MoonNight(name="초승달", lit=0.05, waxing=True, rise_at=None, set_at=None, up_hours=())
+ assert view_line(hidden, 0.0) == "해 진 뒤 곧 져서 밤엔 안 보여요"
+ assert view_line(replace(hidden, name="그믐달", waxing=False), 0.0) == "새벽 늦게 떠서 밤엔 안 보여요"
def test_waning_moon_rises_late():
diff --git a/docs/QA_체크리스트.md b/docs/QA_체크리스트.md
index c0c2310..e3ebbe8 100644
--- a/docs/QA_체크리스트.md
+++ b/docs/QA_체크리스트.md
@@ -47,7 +47,7 @@
- [ ] 오늘 날씨: 시간별 4칸(주황 막대 높이가 기온 비례), 저녁 칸 살구색·밤 칸 보라색
- [ ] 각: "오늘의 각 · N위", 큰 점수, "계산 근거 보기" → 계산 근거 시트
- [ ] 노을: 노을 점수와 시각 칸들 (해 뜨기 전·밤엔 "내일 일출"/"오늘 일출", 명소 장 없음) / 주말 예보: 토·일 칸("비 N% · 일교차 N°") + 검은 팁 줄
-- [ ] 오늘 밤 달: "오늘 밤은 (모양), (잘 보이는지)"(예: 구름에 가려요 · 새벽 2시에 떠요 · 밤 11시까지 보여요), 달 뜸·짐 시각 줄, "밝기 %"는 어디에도 없다
+- [ ] 오늘 밤 달: "오늘 밤은 (모양), (잘 보이는지)"(예: 흐려서 구름에 가려요 · 새벽 2시에 떠요 · 밤 11시까지 보여요 · 해와 같은 쪽에 있어 안 보여요), 안 보일 땐 늘 이유가 붙는다, 달 뜸·짐 시각 줄, "밝기 %"는 어디에도 없다
- [ ] 주말 플랜: 시간·아이콘·제목·설명 줄, 사진이 있으면 작은 사진과 맨 아래 "사진 출처"
- [ ] 행사·당일치기 사진 슬라이드: 사진 위 글자, 오른쪽 위 출처
- [ ] 점선 밑줄 장소 이름 → 네이버 지도 검색이 새 탭으로
diff --git a/docs/점수_계산식.md b/docs/점수_계산식.md
index 6546fe3..f301ea4 100644
--- a/docs/점수_계산식.md
+++ b/docs/점수_계산식.md
@@ -160,9 +160,11 @@
| 조건 | 문구 |
|---|---|
-| 빛나는 면 3% 미만이거나 밤새 안 뜸 | 달이 안 보여요 |
+| 빛나는 면 3% 미만 (삭 무렵) | 해와 같은 쪽에 있어 안 보여요 |
+| 19시~5시에 한 번도 안 뜸, 차오르는 달 | 해 진 뒤 곧 져서 밤엔 안 보여요 |
+| 19시~5시에 한 번도 안 뜸, 기우는 달 | 새벽 늦게 떠서 밤엔 안 보여요 |
| 저녁 7~9시 사이가 아니라 밤늦게 뜸 | 새벽 2시에 떠요 |
-| 달이 떠 있는 시각의 하늘이 흐림 쪽 (맑음 0 · 구름많음 0.5 · 흐림 1의 평균 0.6 이상) | 구름에 가려요 |
+| 달이 떠 있는 시각의 하늘이 흐림 쪽 (맑음 0 · 구름많음 0.5 · 흐림 1의 평균 0.6 이상) | 흐려서 구름에 가려요 |
| 같은 평균 0.3 이상 | 구름 사이로 보여요 |
| 밤사이 짐 | 밤 11시까지 보여요 |
| 그 밖 | 밤새 잘 보여요 |
From 0a98fb88796c1b32aa723a8792bb068a23da82d7 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:36:12 +0900
Subject: [PATCH 14/30] =?UTF-8?q?fix:=20=EB=85=B8=EC=9D=84=20=EA=B2=B0?=
=?UTF-8?q?=EB=A1=A0=EC=9D=B4=20=EA=B3=B5=EA=B8=B0(=EA=B0=80=EC=8B=9C?=
=?UTF-8?q?=EA=B1=B0=EB=A6=AC=C2=B7=EC=8A=B5=EB=8F=84)=EB=A1=9C=20?=
=?UTF-8?q?=EA=B9=8E=EC=9D=B8=20=EC=A0=90=EC=88=98=EC=99=80=20=EC=96=B4?=
=?UTF-8?q?=EA=B8=8B=EB=82=98=EB=8D=98=20=EA=B2=83=20=E2=80=94=20=EA=B3=B5?=
=?UTF-8?q?=EA=B8=B0=20=EB=B3=B4=EC=A0=95=200.7=EB=B0=B0=20=EB=AF=B8?=
=?UTF-8?q?=EB=A7=8C=EC=9D=B4=EB=A9=B4=20=EA=B2=B0=EB=A1=A0=20=ED=95=9C=20?=
=?UTF-8?q?=EB=8B=A8=EA=B3=84=20=EB=82=AE=EC=B6=94=EA=B3=A0=20=EC=9D=B4?=
=?UTF-8?q?=EC=9C=A0=20=ED=91=9C=EC=8B=9C,=20=ED=94=BC=EB=93=9C=20?=
=?UTF-8?q?=EB=85=B8=EC=9D=84=20=EC=B9=B4=EB=93=9C=20=EC=A0=90=EC=88=98=20?=
=?UTF-8?q?=ED=81=AC=EA=B2=8C,=20=EC=98=88=EB=B3=B4=20=EA=B8=B0=EC=A4=80?=
=?UTF-8?q?=20=EC=8B=9C=EA=B0=81=20=ED=91=9C=EC=8B=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 1 +
backend/common/database/model/models.py | 1 +
backend/postgres-init/init.sql | 1 +
backend/services/calc/sky_score.py | 16 ++++++++++++++++
backend/services/feed_service.py | 7 ++++---
backend/services/sky_service.py | 21 +++++++++++++++------
backend/tests/test_sky_score.py | 17 ++++++++++++++++-
docs/점수_계산식.md | 3 ++-
frontend/src/b/Post.tsx | 9 ++++++---
frontend/src/b/SkyPage.tsx | 8 +++++---
10 files changed, 67 insertions(+), 17 deletions(-)
diff --git a/TODO.md b/TODO.md
index 1b8214b..c3c0093 100644
--- a/TODO.md
+++ b/TODO.md
@@ -150,3 +150,4 @@
| [ ] | AEO·SEO 메타데이터 + 구글·네이버 검색 등록 (금일 핵심 업무), 넣은 태그·키워드 정의서 작성, 매시간 갱신 콘텐츠 노출 방식 정리 → 대표 보고. 도메인은 별도 유지 | 10/8 회의 결정 | `frontend/index.html`, `docs/` |
| [ ] | `docs/콘텐츠_구현기획.md` 2-1의 오늘 날씨 점수 식이 예전 기준(기온 40·비 30·바람 15·미세먼지 15) — 새 기준은 `docs/점수_계산식.md` | 점수 계산식 정리 중 발견 (10/8) | `docs/콘텐츠_구현기획.md` |
| [ ] | **[결정 필요]** 각 순위가 점수 순이 아니라 보임 — 순위가 점수 × 중요도라 환기각 92점(하)이 5위, 골프각 89점이 3위, 빨래각 83점이 2위. 각 탭 받침대·스토리에서 높은 점수가 뒤에 있어 어색함. 점수를 순위대로 보여줄지, 중요도 가중을 줄일지 | 화면 직접 확인 중 발견 (10/12) | `backend/services/calc/index_calc.py` (`PRIORITY_WEIGHT`), `frontend/src/b/GakPage.tsx` |
+| [x] | 노을 점수 29점(잿빛)인데 결론 '나가 볼 만해요' — 결론이 구름 분포만 보고 공기 보정(가시거리·습도)을 안 봤음 → 공기 보정 0.7배 미만이면 결론 한 단계 낮추고 이유에 공기 표시, '해 질 무렵(N시) 예보 기준' 표시. 운영 DB에 `sky_score.air` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 사용자 지적 (10/12, 분당구) | `backend/services/sky_service.py` (`day_verdict`, `build_plan`), `backend/services/calc/sky_score.py` (`air_note`) |
diff --git a/backend/common/database/model/models.py b/backend/common/database/model/models.py
index 5a7be6f..21f320b 100644
--- a/backend/common/database/model/models.py
+++ b/backend/common/database/model/models.py
@@ -142,6 +142,7 @@ class SkyScore(Base):
situation: Mapped[Optional[int]] = mapped_column(SmallInteger, nullable=True)
models_total: Mapped[Optional[int]] = mapped_column(SmallInteger, nullable=True)
models_agree: Mapped[Optional[int]] = mapped_column(SmallInteger, nullable=True)
+ air: Mapped[Optional[dict]] = mapped_column(JSONB, nullable=True)
class SunsetSpot(Base):
diff --git a/backend/postgres-init/init.sql b/backend/postgres-init/init.sql
index 9ebce24..b18e791 100644
--- a/backend/postgres-init/init.sql
+++ b/backend/postgres-init/init.sql
@@ -133,6 +133,7 @@ CREATE TABLE IF NOT EXISTS public.sky_score (
ALTER TABLE public.sky_score ADD COLUMN IF NOT EXISTS situation SMALLINT NULL; -- SkySituation: 1=가려짐 2=낮은 구름 3=물들 구름 적음 4=넓게 물듦 5=두꺼움
ALTER TABLE public.sky_score ADD COLUMN IF NOT EXISTS models_total SMALLINT NULL; -- 계산에 쓴 예보 모델 수
ALTER TABLE public.sky_score ADD COLUMN IF NOT EXISTS models_agree SMALLINT NULL; -- 그중 같은 하늘 상황을 낸 모델 수
+ALTER TABLE public.sky_score ADD COLUMN IF NOT EXISTS air JSONB NULL; -- 해 질(뜰) 무렵 공기 보정 {"factor": 0.5, "visibility_km": 6.5, "humidity": 80}. 결론·이유에 쓴다
-- 구별 지수 점수. 오늘·내일·모레와 이번 주말을 날짜별 줄로 둔다 (각 상세 창 칸: 오늘·내일·토·일).
CREATE TABLE IF NOT EXISTS public.index_score (
diff --git a/backend/services/calc/sky_score.py b/backend/services/calc/sky_score.py
index 9f5b035..fadd52a 100644
--- a/backend/services/calc/sky_score.py
+++ b/backend/services/calc/sky_score.py
@@ -1,5 +1,6 @@
import statistics
from dataclasses import dataclass
+from typing import Optional
from datetime import datetime, timedelta
from common.enums import Confidence, SkyGrade, SkySituation, SkyType
@@ -54,6 +55,21 @@ def air_factor(air: Air) -> float:
return f
+HAZY = 0.7 # 공기 보정이 이보다 작으면 결론을 한 단계 낮추고 이유에 공기를 말한다
+
+
+def air_note(air: Optional[dict]) -> Optional[str]:
+ """공기 보정이 크게 깎였으면 그 이유 한 마디 (예: 공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)). 아니면 None."""
+ if not air or air.get("factor") is None or air["factor"] >= HAZY:
+ return None
+ parts = []
+ if air.get("visibility_km") is not None and air["visibility_km"] < 20:
+ parts.append(f"가시거리 {air['visibility_km']:g}km")
+ if air.get("humidity") is not None and air["humidity"] >= 70:
+ parts.append(f"습도 {air['humidity']}%")
+ return "공기가 뿌예 색이 흐려요" + (f" ({'·'.join(parts)})" if parts else "")
+
+
def grade(value: int) -> SkyGrade:
if value >= 80:
return SkyGrade.RED
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index 4abc2cb..394d6fe 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -28,7 +28,7 @@ from services.air_service import pm10_grade, pm25_grade
from services.calc.day_slot import NIGHT_AFTER_SUNSET, slot_of
from services.calc.index_calc import rank_score
from services.calc.moon import MoonNight, nearest, night, view_line
-from services.calc.sky_score import GRADE_LABEL, SITUATION_LINE
+from services.calc.sky_score import GRADE_LABEL, SITUATION_LINE, air_note
from services.calc.sun import sun_times
from services.hero_stats import UV_HIGH, HeroInput, hero_stats, uv_label
from services.index_service import IndexBoard, IndexItem, IndexService
@@ -663,7 +663,8 @@ class FeedService:
target, when, rise = plan.target, plan.when, plan.kind is SkyType.SUNRISE
word, icon = ("일출", "sun") if rise else ("노을", "sunset")
sit = SkySituation(target.situation) if target.situation else None
- line = SITUATION_LINE[sit] if sit else GRADE_LABEL[SkyGrade(target.grade)]
+ # 공기가 뿌예 결론이 낮아졌으면 그 이유를, 아니면 하늘 상황을
+ line = "공기가 뿌예 색이 흐려요" if air_note(target.air) else SITUATION_LINE[sit] if sit else GRADE_LABEL[SkyGrade(target.grade)]
better = plan.outlook
sun = next((b for b in target.best_times if b["kind"] == "sun"), target.best_times[0])
sun_at = datetime.fromisoformat(sun["at"]).astimezone(KST)
@@ -672,7 +673,7 @@ class FeedService:
slides=[], share_messages=[f"{when} {word}은 쉬어요, {line}"])
cuts = [Cut(**b) for b in target.best_times if b["kind"] != "peak"]
slides = [SunsetSlide(kind="sunset", eyebrow=f"{when} {word} · {c.region.name}", line=line, score=target.score,
- grade_label=line, cuts=cuts, situation=sit)]
+ grade_label=GRADE_LABEL[SkyGrade(target.grade)], cuts=cuts, situation=sit)]
if c.sky.spots and not rise:
slides.append(RowsSlide(kind="rows", eyebrow="가까운 노을 명소", line=f"해 지는 {compass(c.sky.sunset_azimuth)}쪽", icon="sunset",
rows=[Row(label=f"{n + 1} {x.spot.name}", value=f"{compass(x.direction)} {x.distance_km}km", place=x.spot.name) for n, x in enumerate(c.sky.spots)]))
diff --git a/backend/services/sky_service.py b/backend/services/sky_service.py
index 36f7bbb..eafdf2a 100644
--- a/backend/services/sky_service.py
+++ b/backend/services/sky_service.py
@@ -21,7 +21,7 @@ from crud.region_crud import RegionCRUD
from crud.sky_crud import SkyCRUD
from services.calc.sky_score import (
DISTANCES_KM, GRADE_LABEL, RAIN_BEFORE_HOURS, SITUATION_LINE, SITUATION_VERDICT, VERDICT_LINE, VERDICT_RANK, Air, Layers, air_factor, best_times,
- confidence, grade, mean_layers, reason, score, situation, sunrise_timeline, sunset_timeline, verdict,
+ air_note, confidence, grade, mean_layers, reason, score, situation, sunrise_timeline, sunset_timeline, verdict,
)
from services.calc.sun import SunTimes, sun_times
from services.external.open_meteo import OpenMeteoRequestFailed, fetch_clouds, parse_clouds
@@ -107,8 +107,11 @@ def _subject(word: str) -> str:
def day_verdict(x: SkyScore) -> str:
- """하늘 상황이 있으면 그걸로, 없으면(예전 계산분) 점수로."""
- return SITUATION_VERDICT[SkySituation(x.situation)] if x.situation else verdict(x.score)
+ """하늘 상황이 있으면 그걸로, 없으면(예전 계산분) 점수로. 공기가 뿌예 점수가 크게 깎였으면 한 단계 낮춘다."""
+ v = SITUATION_VERDICT[SkySituation(x.situation)] if x.situation else verdict(x.score)
+ if air_note(getattr(x, "air", None)) is not None and VERDICT_RANK[v] > 0:
+ v = next(k for k, r in VERDICT_RANK.items() if r == VERDICT_RANK[v] - 1)
+ return v
def outlook(target: SkyScore, days: list[SkyScore], today: date) -> str:
@@ -132,9 +135,11 @@ def build_plan(
peak_at = datetime.fromisoformat(peak["at"]) if peak else None
return SkyPlan(
kind=kind, target=target, day=target.score_date, when=when, verdict=v, headline=VERDICT_LINE[v],
- reason=reason(*layers, kind) if layers else _FALLBACK_REASON[v],
+ reason=", ".join(filter(None, [reason(*layers, kind) if layers else _FALLBACK_REASON[v], air_note(target.air)])),
score=target.score, grade_label=GRADE_LABEL[SkyGrade(target.grade)],
- situation_label=SITUATION_LINE[SkySituation(target.situation)] if target.situation else None,
+ situation_label=(
+ "공기가 뿌예 색이 흐려요" if air_note(target.air) else SITUATION_LINE[SkySituation(target.situation)] if target.situation else None
+ ),
models_total=target.models_total, models_agree=target.models_agree,
best_at=peak_at, spot=spots[0] if spots and v != "rest" and not rise else None,
timeline=(
@@ -219,7 +224,9 @@ def _score_rows(
model_layers.append(layers)
if not per_model:
continue
- value = min(100, round(statistics.mean(per_model) * air_factor(_air(region.code, sun_at, hourly or {}, om or {}))))
+ air = _air(region.code, sun_at, hourly or {}, om or {})
+ factor = air_factor(air)
+ value = min(100, round(statistics.mean(per_model) * factor))
sit = situation(*(mean_layers([m[k] for m in model_layers]) for k in range(len(DISTANCES_KM))))
rows.append({
"region_code": region.code, "score_date": d, "sky_type": kind.value, "score": value, "grade": grade(value).value,
@@ -227,6 +234,8 @@ def _score_rows(
"best_times": best_times(kind, sun_at.astimezone(KST), twilight_at.astimezone(KST), statistics.mean(highs)),
"computed_at": now,
"situation": sit.value, "models_total": len(model_layers), "models_agree": sum(situation(*m) is sit for m in model_layers),
+ "air": {"factor": round(factor, 2), "visibility_km": round(air.visibility_km, 1) if air.visibility_km is not None else None,
+ "humidity": air.humidity},
})
return rows
diff --git a/backend/tests/test_sky_score.py b/backend/tests/test_sky_score.py
index 25814f4..926d2fd 100644
--- a/backend/tests/test_sky_score.py
+++ b/backend/tests/test_sky_score.py
@@ -1,6 +1,6 @@
from datetime import date, datetime, timedelta, timezone
-from common.enums import Confidence, SkyGrade, SkyType
+from common.enums import Confidence, SkyGrade, SkySituation, SkyType
from common.utils.geo import destination, haversine_km
from services.calc.sky_score import (
GRADE_LABEL, Air, Layers, air_factor, best_times, confidence, grade, reason, score, situation, sunset_timeline, verdict,
@@ -127,3 +127,18 @@ def test_sunrise_reason_and_timeline():
rows = sunrise_timeline(sun.dawn_start_at, sun.sunrise_at, sun.golden_end_at)
assert [r["kind"] for r in rows] == ["blue", "sun", "golden"]
assert sun.dawn_start_at < sun.sunrise_at < sun.golden_end_at
+
+
+def test_hazy_air_lowers_verdict_and_says_why():
+ from types import SimpleNamespace
+
+ from services.calc.sky_score import air_note
+ from services.sky_service import day_verdict
+
+ hazy = {"factor": 0.5, "visibility_km": 6.5, "humidity": 80}
+ assert air_note(hazy) == "공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)"
+ assert air_note({"factor": 0.9, "visibility_km": 30.0, "humidity": 60}) is None
+ glow = SimpleNamespace(situation=SkySituation.GLOW.value, score=29, air=hazy)
+ assert day_verdict(glow) == "maybe"
+ assert day_verdict(SimpleNamespace(situation=SkySituation.GLOW.value, score=60, air=None)) == "go"
+ assert day_verdict(SimpleNamespace(situation=SkySituation.COVERED.value, score=10, air=hazy)) == "rest"
diff --git a/docs/점수_계산식.md b/docs/점수_계산식.md
index f301ea4..5204f92 100644
--- a/docs/점수_계산식.md
+++ b/docs/점수_계산식.md
@@ -135,7 +135,8 @@
- **무엇을 보여 주나**: 다음에 오는 것. 오늘 해 뜨기 전엔 오늘 일출, 그 뒤 블루아워가 끝나기 전엔 오늘 노을, 그 뒤엔 내일 일출. 피드 노을 카드도 같습니다. 일출도 같은 식으로 계산합니다(구름은 해 뜨는 쪽).
- 노을 탭 히어로는 점수를 크게 보여 주고, 그 아래에 해 지는(뜨는) 시각과 하늘 상황을 씁니다.
-- 화면 결론(나가 볼 만해요·애매해요·쉬어요)은 **하늘 상황 기준**입니다. 상황이 없을 때만 점수로 정합니다(60↑ 나가 볼 만해요, 40↑ 애매해요).
+- 점수는 **지금 하늘이 아니라 해 질(뜰) 무렵 예보**로 낸 값입니다. 노을 탭에 "해 질 무렵(18시) 예보 기준"으로 적습니다.
+- 화면 결론(나가 볼 만해요·애매해요·쉬어요)은 **하늘 상황 기준**이고, **공기 보정이 0.7배 미만이면 한 단계 낮춥니다.** 이때 이유에 "공기가 뿌예 색이 흐려요 (가시거리 N km·습도 N%)"를 붙이고, 히어로·피드 카드의 상황 줄도 이 말로 바꿉니다. 예) 분당구 10/12: 구름 57점 × 공기 0.50(가시거리 6.5km 0.62 · 습도 80% 0.81) = 29점 잿빛 → '하늘이 넓게 물들 수 있어요'였던 결론이 '애매해요'로. 상황이 없을 때만 점수로 정합니다(60↑ 나가 볼 만해요, 40↑ 애매해요).
- 확신도: 모델별 점수의 표준편차가 8 미만이면 높음, 15 미만이면 보통, 그 이상이거나 모델이 1개면 낮음.
- 노을 순위: 대표 30곳을 노을 점수순으로 정렬합니다. 70% 이상이 같은 상황이면 한 줄 요약을 붙입니다.
diff --git a/frontend/src/b/Post.tsx b/frontend/src/b/Post.tsx
index 580beed..a5664ef 100644
--- a/frontend/src/b/Post.tsx
+++ b/frontend/src/b/Post.tsx
@@ -130,10 +130,13 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
return (
{slide.eyebrow}
-
+
+ {slide.score}
+ 점 · {slide.grade_label}
+
+
-
- 노을 점수 {slide.score}
+
{slide.cuts.map((c, i) => (
diff --git a/frontend/src/b/SkyPage.tsx b/frontend/src/b/SkyPage.tsx
index b244ea8..6518031 100644
--- a/frontend/src/b/SkyPage.tsx
+++ b/frontend/src/b/SkyPage.tsx
@@ -51,9 +51,11 @@ function HeroBody({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
}
/** 결론과 이유, 예보 모델이 얼마나 같은 예보를 냈는지, 점수(작게) */
-function Verdict({ plan }: { plan?: SkyPlanData }) {
+function Verdict({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
const v = (node: ReactNode, w: string) => (plan ? node : )
- const agree = plan?.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : ''
+ // 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 걸 밝힌다
+ const basis = sunAt ? `해 ${plan?.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 예보 기준` : ''
+ const agree = [basis, plan?.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : ''].filter(Boolean).join(' · ')
return (
@@ -174,7 +176,7 @@ export function SkyPage() {
sky.refetch()} empty="오늘 노을 정보가 없어요." hold={} className="inset-x-0 top-1.5 bottom-0" />
)}
- {(plan || load === 'loading') && }
+ {(plan || load === 'loading') && }
{plan?.timeline?.length || load === 'loading' ? (
From 8422829f9d65e059d2c3287d795c4f02c0a3586d Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 09:53:07 +0900
Subject: [PATCH 15/30] =?UTF-8?q?fix:=20=EB=85=B8=EC=9D=84=20=ED=83=AD=20?=
=?UTF-8?q?=ED=9E=88=EC=96=B4=EB=A1=9C=EB=A5=BC=20=EB=8B=A4=EC=8B=9C=20?=
=?UTF-8?q?=ED=95=B4=20=EC=A7=80=EB=8A=94=20=EC=8B=9C=EA=B0=81=20=ED=81=AC?=
=?UTF-8?q?=EA=B2=8C,=20=EC=A0=90=EC=88=98=EB=8A=94=20=EA=B2=B0=EB=A1=A0?=
=?UTF-8?q?=20=EC=B9=B4=EB=93=9C=20=EC=95=84=EB=9E=98=20=EC=A4=84=EB=A1=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 3 ++-
frontend/src/b/SkyPage.tsx | 18 ++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/TODO.md b/TODO.md
index c3c0093..1490c69 100644
--- a/TODO.md
+++ b/TODO.md
@@ -145,9 +145,10 @@
| [x] | 각 점수를 아침·낮·저녁·밤 시간대별로 → 지금 구간 점수로 순위, 안 겹치는 각은 순위·피드에서 빼고 스토리·전체엔 '지금 아님'. 히어로는 '지금 날씨 점수'(지금 구간). 운영 DB에 `index_score.slots` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 10/8 회의 결정 | `backend/services/calc/index_calc.py:297` |
| [x] | 히어로에 습도·불쾌지수 항상 표시 → 4칸(지금·습도·불쾌지수·상황 1칸, 사용자 결정). 불쾌지수 75 이상이면 경고 색, 상황 칸 후보에서 불쾌지수 뺌 | 10/8 회의 결정 | `frontend/src/b/TodayPage.tsx` (`HeroStat`) |
| [x] | 달: '밝기 %' 표시 뺌 → 모양 + 잘 보이는지(구름·뜨고 지는 시각). 모양은 실제 해·달 황경 차이로(예전 계산은 보름을 반나절 일찍 판정). 별보기각은 빛나는 면 × 떠 있는 비율 (사용자 결정) | 10/8 회의 | `backend/services/calc/moon.py` |
-| [x] | 노을: 점수 강조(히어로에 점수 크게) + 골든아워·블루아워 설명. 결론은 다음에 오는 것(해 뜨기 전·밤엔 일출, 그 사이엔 노을)으로, 피드 노을 카드도 같이 (사용자 결정 '각·노을도 지금 기준') | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
+| [x] | 노을: 점수 강조(히어로에 점수 크게) → 사용자가 '29점이 키포인트 정보냐'고 해 히어로는 다시 시각 크게, 점수는 결론 카드 아래 줄로(10/12). 골든아워·블루아워 설명. 결론은 다음에 오는 것(해 뜨기 전·밤엔 일출, 그 사이엔 노을)으로, 피드 노을 카드도 같이 (사용자 결정 '각·노을도 지금 기준') | 10/8 회의, 사용자 결정 | `frontend/src/b/SkyPage.tsx`, `backend/services/sky_service.py` |
| [x] | 주말 예보 UI 개선 → 피드 주말 예보 카드: 토·일 칸을 제목 바로 아래로(칸이 바닥에 붙어 가운데가 비어 오류처럼 보였음), 칸마다 '이날 할 만한 각' 3개 (사용자 의견) | 10/8 회의 | `frontend/src/b/WeekPage.tsx` |
| [ ] | AEO·SEO 메타데이터 + 구글·네이버 검색 등록 (금일 핵심 업무), 넣은 태그·키워드 정의서 작성, 매시간 갱신 콘텐츠 노출 방식 정리 → 대표 보고. 도메인은 별도 유지 | 10/8 회의 결정 | `frontend/index.html`, `docs/` |
| [ ] | `docs/콘텐츠_구현기획.md` 2-1의 오늘 날씨 점수 식이 예전 기준(기온 40·비 30·바람 15·미세먼지 15) — 새 기준은 `docs/점수_계산식.md` | 점수 계산식 정리 중 발견 (10/8) | `docs/콘텐츠_구현기획.md` |
| [ ] | **[결정 필요]** 각 순위가 점수 순이 아니라 보임 — 순위가 점수 × 중요도라 환기각 92점(하)이 5위, 골프각 89점이 3위, 빨래각 83점이 2위. 각 탭 받침대·스토리에서 높은 점수가 뒤에 있어 어색함. 점수를 순위대로 보여줄지, 중요도 가중을 줄일지 | 화면 직접 확인 중 발견 (10/12) | `backend/services/calc/index_calc.py` (`PRIORITY_WEIGHT`), `frontend/src/b/GakPage.tsx` |
| [x] | 노을 점수 29점(잿빛)인데 결론 '나가 볼 만해요' — 결론이 구름 분포만 보고 공기 보정(가시거리·습도)을 안 봤음 → 공기 보정 0.7배 미만이면 결론 한 단계 낮추고 이유에 공기 표시, '해 질 무렵(N시) 예보 기준' 표시. 운영 DB에 `sky_score.air` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 사용자 지적 (10/12, 분당구) | `backend/services/sky_service.py` (`day_verdict`, `build_plan`), `backend/services/calc/sky_score.py` (`air_note`) |
+| [ ] | 노을 탭 다시 짜기 — 처음 보면 '그래서 가?'에서 멈춤: 히어로 18:00이 무슨 시각인지 없음, 결론 카드가 좋은 말·나쁜 말을 섞음, 구름 %·예보 모델 수 같은 전문 용어, '가장 붉을 때'가 시간표에 없음, '내일이 더 나아요'가 맨 아래. 시안 먼저 보고 결정 | 사용자 지적 (10/12) | `frontend/src/b/SkyPage.tsx`, `backend/services/calc/sky_score.py` (`reason`) |
diff --git a/frontend/src/b/SkyPage.tsx b/frontend/src/b/SkyPage.tsx
index 6518031..ced6393 100644
--- a/frontend/src/b/SkyPage.tsx
+++ b/frontend/src/b/SkyPage.tsx
@@ -33,19 +33,13 @@ const HERO = 'relative mx-3 mt-1 min-h-[230px] overflow-hidden rounded-[32px] px
const THREE = [0, 1, 2]
const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i)
-/** 히어로엔 점수를 크게, 아래에 해 지는(뜨는) 시각과 하늘 상황 한 줄. 결론·이유는 아래 카드로 */
+/** 히어로엔 해 지는(뜨는) 시각과 하늘 상황 한 줄만. 결론·이유·점수는 아래 카드로 */
function HeroBody({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
const v = (node: ReactNode, w: string) => (plan ? node : )
- const rise = plan?.kind === 'sunrise'
return (
-
- {v(plan?.score, 'w-[110px]')}
- {plan && 점 · {plan.grade_label}}
-
- {(plan || load === 'loading') && }
+ {/* 더 나은 날이 있으면 히어로 바로 아래 */}
+ {plan?.outlook &&
{plan.outlook}
}
+ {plan && }
{plan?.timeline?.length || load === 'loading' ? (
) : (
} className="inset-x-3 top-3 bottom-0" />
)}
- {/* 더 나은 날이 있을 때만 */}
- {plan?.outlook &&
{plan.outlook}
}
{!rise && }
{rise ? null : spots.length ? (
From f5575711fe2717d524073823bcd7ec7d3f51a9bb Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Mon, 12 Oct 2026 10:09:09 +0900
Subject: [PATCH 17/30] =?UTF-8?q?feat:=20=ED=94=BC=EB=93=9C=20=EB=85=B8?=
=?UTF-8?q?=EC=9D=84=20=EC=B9=B4=EB=93=9C=EB=8F=84=20=EA=B2=B0=EB=A1=A0?=
=?UTF-8?q?=C2=B7=EA=B0=80=EC=9E=A5=20=EB=B6=89=EC=9D=84=20=EB=95=8C=C2=B7?=
=?UTF-8?q?=EC=89=AC=EC=9A=B4=20=EC=9D=B4=EC=9C=A0=EB=A1=9C,=20=EB=85=B8?=
=?UTF-8?q?=EC=9D=84=20=EC=9D=B4=EC=9C=A0=EB=A5=BC=20=EC=88=AB=EC=9E=90=20?=
=?UTF-8?q?=EC=97=86=EB=8A=94=20=EC=89=AC=EC=9A=B4=20=EB=A7=90=EB=A1=9C,?=
=?UTF-8?q?=20=EC=9E=90=EC=84=B8=ED=9E=88=EC=97=90=EC=84=9C=20=EC=98=88?=
=?UTF-8?q?=EB=B3=B4=20=EB=AA=A8=EB=8D=B8=20=EC=88=98=20=EB=B9=BC=EA=B3=A0?=
=?UTF-8?q?=20=EC=A0=90=EC=88=98=20=EB=9C=BB=20=EC=84=A4=EB=AA=85,=20?=
=?UTF-8?q?=EB=85=B8=EC=9D=84=20=ED=83=AD=20=EC=98=A4=EB=8A=98=C2=B7?=
=?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=A4=91=EB=B3=B5=20=EC=B9=A9=20=EC=A0=9C?=
=?UTF-8?q?=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/router/v1/feed/protocol.py | 2 ++
backend/services/calc/sky_score.py | 32 +++++++++++++++-------------
backend/services/feed_service.py | 9 ++++----
backend/services/sky_service.py | 2 +-
backend/tests/test_sky_api.py | 2 +-
backend/tests/test_sky_score.py | 10 ++++-----
docs/점수_계산식.md | 2 +-
frontend/src/api/client/types.gen.ts | 12 +++++++++++
frontend/src/b/Post.tsx | 9 ++++----
frontend/src/b/SkyPage.tsx | 15 +++++--------
10 files changed, 53 insertions(+), 42 deletions(-)
diff --git a/backend/router/v1/feed/protocol.py b/backend/router/v1/feed/protocol.py
index 42c07a1..b088dcd 100644
--- a/backend/router/v1/feed/protocol.py
+++ b/backend/router/v1/feed/protocol.py
@@ -64,6 +64,8 @@ class SunsetSlide(WebPacketProtocol):
grade_label: str
cuts: list[Cut]
situation: Optional[SkySituation] = Field(default=None, description="하늘 상황. 앱이 카드 하늘 색을 고른다")
+ headline: Optional[str] = Field(default=None, description="결론 (나가 볼 만해요 · 애매해요 · 쉬어요). 카드 맨 위에 크게")
+ peak_at: Optional[datetime] = Field(default=None, description="가장 붉을 때")
class WeekGak(WebPacketProtocol):
diff --git a/backend/services/calc/sky_score.py b/backend/services/calc/sky_score.py
index bb57f67..975691e 100644
--- a/backend/services/calc/sky_score.py
+++ b/backend/services/calc/sky_score.py
@@ -59,15 +59,17 @@ HAZY = 0.7 # 공기 보정이 이보다 작으면 결론을 한 단계 낮추
def air_note(air: Optional[dict]) -> Optional[str]:
- """공기 보정이 크게 깎였으면 그 이유 한 마디 (예: 공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)). 아니면 None."""
+ """공기 보정이 크게 깎였으면 그 이유를 눈에 보이는 말로 (숫자 없이). 아니면 None.
+ 가시거리 20km 미만 = 먼 건물이 흐릿하게 보이는 정도, 습도 70% 이상 = 습한 공기."""
if not air or air.get("factor") is None or air["factor"] >= HAZY:
return None
- parts = []
- if air.get("visibility_km") is not None and air["visibility_km"] < 20:
- parts.append(f"가시거리 {air['visibility_km']:g}km")
- if air.get("humidity") is not None and air["humidity"] >= 70:
- parts.append(f"습도 {air['humidity']}%")
- return "공기가 뿌예 색이 흐려요" + (f" ({'·'.join(parts)})" if parts else "")
+ hazy = air.get("visibility_km") is not None and air["visibility_km"] < 20
+ humid = air.get("humidity") is not None and air["humidity"] >= 70
+ if hazy and humid:
+ return "먼 건물이 흐릿할 만큼 공기가 뿌옇고 습해서 노을 색이 바래 보일 거예요"
+ if hazy:
+ return "먼 건물이 흐릿할 만큼 공기가 뿌예서 노을 색이 바래 보일 거예요"
+ return "공기가 습해서 노을 색이 바래 보일 거예요"
def plain_line(situation: SkySituation | None, air: Optional[dict], kind: SkyType = SkyType.SUNSET) -> Optional[str]:
@@ -83,8 +85,8 @@ def plain_line(situation: SkySituation | None, air: Optional[dict], kind: SkyTyp
if air_note(air) is None:
return base
if situation is SkySituation.GLOW:
- return "구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요"
- return f"{base}. 공기도 뿌예요" if base else "공기가 뿌예서 색이 흐릴 거예요"
+ return "구름은 좋은데 공기가 뿌예서 색이 바랠 거예요"
+ return f"{base}. 공기도 뿌예요" if base else "공기가 뿌예서 색이 바랠 거예요"
def grade(value: int) -> SkyGrade:
@@ -168,17 +170,17 @@ def reason(near20: Layers, far100: Layers, kind: SkyType = SkyType.SUNSET) -> st
"""score() 가 깎는 순서대로 본다: 먼 쪽 빛이 막혔나 → 머리 위 낮은 구름 → 물들 중·높은 구름의 양."""
side = "해 뜨는 쪽" if kind is SkyType.SUNRISE else "해 지는 쪽"
if far100.low + 0.5 * far100.mid >= 60:
- return f"{side} 먼 하늘이 구름에 막혀 빛이 못 들어와요"
+ return f"{side} 멀리까지 구름이 끼어 햇빛이 하늘을 물들이지 못해요"
if near20.low >= 60:
- return "낮은 구름이 머리 위를 덮어 붉은빛을 가려요"
+ return "낮게 깔린 구름이 하늘을 덮어 붉은빛을 가려요"
canvas = round(max(near20.mid, near20.high))
if canvas < 10:
- return "물들 구름이 거의 없어 하늘이 은은하게 끝나요"
+ return "하늘에 구름이 거의 없어요. 노을은 구름에 햇빛이 비쳐야 붉어져서 은은하게 끝나요"
if canvas > 85:
- return f"중·높은 구름이 {canvas}%로 두꺼워 빛이 덜 비쳐요"
+ return "구름이 너무 두껍게 덮여 햇빛이 잘 안 비쳐요"
if 25 <= canvas <= 75:
- return f"중·높은 구름이 {canvas}% 알맞게 깔리고 {side}이 트였어요"
- return f"물들 중·높은 구름이 {canvas}%로 {'적은' if canvas < 25 else '많은'} 편이에요"
+ return f"{side} 하늘에 구름이 적당히 있어 햇빛을 받아 물들기 좋아요"
+ return f"구름이 {'적은' if canvas < 25 else '많은'} 편이라 물드는 색이 약할 수 있어요"
def sunrise_timeline(blue_at: datetime, peak_at: datetime | None, sun_at: datetime, golden_end_at: datetime) -> list[dict]:
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index 394d6fe..b545dcf 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -28,7 +28,7 @@ from services.air_service import pm10_grade, pm25_grade
from services.calc.day_slot import NIGHT_AFTER_SUNSET, slot_of
from services.calc.index_calc import rank_score
from services.calc.moon import MoonNight, nearest, night, view_line
-from services.calc.sky_score import GRADE_LABEL, SITUATION_LINE, air_note
+from services.calc.sky_score import GRADE_LABEL
from services.calc.sun import sun_times
from services.hero_stats import UV_HIGH, HeroInput, hero_stats, uv_label
from services.index_service import IndexBoard, IndexItem, IndexService
@@ -663,8 +663,8 @@ class FeedService:
target, when, rise = plan.target, plan.when, plan.kind is SkyType.SUNRISE
word, icon = ("일출", "sun") if rise else ("노을", "sunset")
sit = SkySituation(target.situation) if target.situation else None
- # 공기가 뿌예 결론이 낮아졌으면 그 이유를, 아니면 하늘 상황을
- line = "공기가 뿌예 색이 흐려요" if air_note(target.air) else SITUATION_LINE[sit] if sit else GRADE_LABEL[SkyGrade(target.grade)]
+ # 노을 탭 히어로와 같은 쉬운 말 한 줄 (공기가 뿌예 결론이 낮아졌으면 그 이유까지)
+ line = plan.situation_label or GRADE_LABEL[SkyGrade(target.grade)]
better = plan.outlook
sun = next((b for b in target.best_times if b["kind"] == "sun"), target.best_times[0])
sun_at = datetime.fromisoformat(sun["at"]).astimezone(KST)
@@ -673,7 +673,8 @@ class FeedService:
slides=[], share_messages=[f"{when} {word}은 쉬어요, {line}"])
cuts = [Cut(**b) for b in target.best_times if b["kind"] != "peak"]
slides = [SunsetSlide(kind="sunset", eyebrow=f"{when} {word} · {c.region.name}", line=line, score=target.score,
- grade_label=GRADE_LABEL[SkyGrade(target.grade)], cuts=cuts, situation=sit)]
+ grade_label=GRADE_LABEL[SkyGrade(target.grade)], cuts=cuts, situation=sit,
+ headline=plan.headline, peak_at=plan.best_at)]
if c.sky.spots and not rise:
slides.append(RowsSlide(kind="rows", eyebrow="가까운 노을 명소", line=f"해 지는 {compass(c.sky.sunset_azimuth)}쪽", icon="sunset",
rows=[Row(label=f"{n + 1} {x.spot.name}", value=f"{compass(x.direction)} {x.distance_km}km", place=x.spot.name) for n, x in enumerate(c.sky.spots)]))
diff --git a/backend/services/sky_service.py b/backend/services/sky_service.py
index fec3702..f2f91c9 100644
--- a/backend/services/sky_service.py
+++ b/backend/services/sky_service.py
@@ -135,7 +135,7 @@ def build_plan(
peak_at = datetime.fromisoformat(peak["at"]) if peak else None
return SkyPlan(
kind=kind, target=target, day=target.score_date, when=when, verdict=v, headline=VERDICT_LINE[v],
- reason=", ".join(filter(None, [reason(*layers, kind) if layers else _FALLBACK_REASON[v], air_note(target.air)])),
+ reason=". ".join(filter(None, [reason(*layers, kind) if layers else _FALLBACK_REASON[v], air_note(target.air)])),
score=target.score, grade_label=GRADE_LABEL[SkyGrade(target.grade)],
situation_label=plain_line(SkySituation(target.situation) if target.situation else None, target.air, kind),
models_total=target.models_total, models_agree=target.models_agree,
diff --git a/backend/tests/test_sky_api.py b/backend/tests/test_sky_api.py
index 074ea87..757d39b 100644
--- a/backend/tests/test_sky_api.py
+++ b/backend/tests/test_sky_api.py
@@ -52,7 +52,7 @@ async def test_sky_view_scores_three_days_with_spots(monkeypatch, clean):
assert 255 <= body["sunset_azimuth"] <= 280
plan = body["plan"]
assert plan["verdict"] == "go" and plan["headline"] == "나가 볼 만해요" and plan["when"] in ("오늘", "내일")
- assert "알맞게" in plan["reason"]
+ assert "적당히" in plan["reason"]
assert plan["spot"]["name"] == "망원한강공원" and plan["best_at"]
assert [t["kind"] for t in plan["timeline"]] == ["golden", "sun", "peak", "blue"]
assert plan["situation_label"] == "구름이 알맞게 깔려 하늘이 넓게 물들어요" and plan["models_agree"] == plan["models_total"] == 2
diff --git a/backend/tests/test_sky_score.py b/backend/tests/test_sky_score.py
index 554ca9d..4dbef65 100644
--- a/backend/tests/test_sky_score.py
+++ b/backend/tests/test_sky_score.py
@@ -64,9 +64,9 @@ def test_sunset_best_times_order():
def test_reason_names_what_decided_the_score():
canvas = Layers(low=0, mid=20, high=50)
- assert "알맞게" in reason(canvas, CLEAR)
- assert "먼 하늘" in reason(canvas, Layers(low=90, mid=50, high=0))
- assert "낮은 구름" in reason(Layers(100, 0, 0), CLEAR)
+ assert "적당히" in reason(canvas, CLEAR)
+ assert "멀리까지 구름이 끼어" in reason(canvas, Layers(low=90, mid=50, high=0))
+ assert "낮게 깔린 구름" in reason(Layers(100, 0, 0), CLEAR)
assert "거의 없어" in reason(CLEAR, CLEAR)
@@ -136,7 +136,7 @@ def test_hazy_air_lowers_verdict_and_says_why():
from services.sky_service import day_verdict
hazy = {"factor": 0.5, "visibility_km": 6.5, "humidity": 80}
- assert air_note(hazy) == "공기가 뿌예 색이 흐려요 (가시거리 6.5km·습도 80%)"
+ assert air_note(hazy) == "먼 건물이 흐릿할 만큼 공기가 뿌옇고 습해서 노을 색이 바래 보일 거예요"
assert air_note({"factor": 0.9, "visibility_km": 30.0, "humidity": 60}) is None
glow = SimpleNamespace(situation=SkySituation.GLOW.value, score=29, air=hazy)
assert day_verdict(glow) == "maybe"
@@ -149,5 +149,5 @@ def test_plain_line_says_it_simply():
hazy = {"factor": 0.5, "visibility_km": 6.5, "humidity": 80}
assert plain_line(SkySituation.GLOW, None) == "구름이 알맞게 깔려 하늘이 넓게 물들어요"
- assert plain_line(SkySituation.GLOW, hazy) == "구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요"
+ assert plain_line(SkySituation.GLOW, hazy) == "구름은 좋은데 공기가 뿌예서 색이 바랠 거예요"
assert plain_line(SkySituation.FEW, hazy) == "구름이 거의 없어 짧고 은은하게 끝나요. 공기도 뿌예요"
diff --git a/docs/점수_계산식.md b/docs/점수_계산식.md
index 2f7c077..341a8ac 100644
--- a/docs/점수_계산식.md
+++ b/docs/점수_계산식.md
@@ -136,7 +136,7 @@
- **무엇을 보여 주나**: 다음에 오는 것. 오늘 해 뜨기 전엔 오늘 일출, 그 뒤 블루아워가 끝나기 전엔 오늘 노을, 그 뒤엔 내일 일출. 피드 노을 카드도 같습니다. 일출도 같은 식으로 계산합니다(구름은 해 뜨는 쪽).
- 노을 탭 히어로는 답만 보여 줍니다: '오늘은 애매해요'(결론), '18:10쯤 가장 붉어요', 쉬운 말 이유 한 줄(예: 구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요). 더 나은 날이 있으면 바로 아래, 점수·구름·예보 모델 수는 '자세히'에 접어 둡니다.
- 점수는 **지금 하늘이 아니라 해 질(뜰) 무렵 예보**로 낸 값입니다. 노을 탭에 "해 질 무렵(18시) 예보 기준"으로 적습니다.
-- 화면 결론(나가 볼 만해요·애매해요·쉬어요)은 **하늘 상황 기준**이고, **공기 보정이 0.7배 미만이면 한 단계 낮춥니다.** 이때 이유에 "공기가 뿌예 색이 흐려요 (가시거리 N km·습도 N%)"를 붙이고, 히어로·피드 카드의 상황 줄도 이 말로 바꿉니다. 예) 분당구 10/12: 구름 57점 × 공기 0.50(가시거리 6.5km 0.62 · 습도 80% 0.81) = 29점 잿빛 → '하늘이 넓게 물들 수 있어요'였던 결론이 '애매해요'로. 상황이 없을 때만 점수로 정합니다(60↑ 나가 볼 만해요, 40↑ 애매해요).
+- 화면 결론(나가 볼 만해요·애매해요·쉬어요)은 **하늘 상황 기준**이고, **공기 보정이 0.7배 미만이면 한 단계 낮춥니다.** 이때 이유에 숫자 없이 "먼 건물이 흐릿할 만큼 공기가 뿌옇고 습해서 노을 색이 바래 보일 거예요"(가시거리 20km 미만 = 먼 건물이 흐릿함, 습도 70% 이상 = 습함)를 붙이고, 히어로·피드 카드의 상황 줄도 이 말로 바꿉니다. 예) 분당구 10/12: 구름 57점 × 공기 0.50(가시거리 6.5km 0.62 · 습도 80% 0.81) = 29점 잿빛 → '하늘이 넓게 물들 수 있어요'였던 결론이 '애매해요'로. 상황이 없을 때만 점수로 정합니다(60↑ 나가 볼 만해요, 40↑ 애매해요).
- 확신도: 모델별 점수의 표준편차가 8 미만이면 높음, 15 미만이면 보통, 그 이상이거나 모델이 1개면 낮음.
- 노을 순위: 대표 30곳을 노을 점수순으로 정렬합니다. 70% 이상이 같은 상황이면 한 줄 요약을 붙입니다.
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index 6f7d340..72a0ccd 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -2301,6 +2301,18 @@ export type SunsetSlide = {
* 하늘 상황. 앱이 카드 하늘 색을 고른다
*/
situation?: SkySituation | null;
+ /**
+ * Headline
+ *
+ * 결론 (나가 볼 만해요 · 애매해요 · 쉬어요). 카드 맨 위에 크게
+ */
+ headline?: string | null;
+ /**
+ * Peak At
+ *
+ * 가장 붉을 때
+ */
+ peak_at?: string | null;
};
/**
diff --git a/frontend/src/b/Post.tsx b/frontend/src/b/Post.tsx
index a5664ef..e5c1762 100644
--- a/frontend/src/b/Post.tsx
+++ b/frontend/src/b/Post.tsx
@@ -130,11 +130,10 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
return (
{slide.eyebrow}
-
- {slide.score}
- 점 · {slide.grade_label}
-
-
+ {/* 노을 탭 히어로와 같은 순서: 결론 → 가장 붉을 때 → 쉬운 이유. 점수는 노을 탭 '자세히'에 */}
+ {slide.headline ?? slide.grade_label}
+ {slide.peak_at &&