[feat] solution: 날씨 조건 세분화,

공식채널 단일화, 한일옥 거리 반영
날씨 조건을 7종으로 세분화,
축제 종료 여부와 무관하게 상시 노출,
'지역 읽기'갈래 축소, 야놀자(NOL) 브랜드명 제거.
This commit is contained in:
skkim committed 2026-09-17 17:02:48 +09:00
1 parent 29af37f158
commit 1f26bc7065
23 files changed
+421 -185

No files matched your search

+5 -18
View File
@@ -15,10 +15,10 @@ import {
type WeatherBand,
type WeatherMood,
} from '@o2o/shared';
import {BOOKING_CHANNELS, UNIT_SPEC, publicLinks, unitBaseRate} from '@site/seo/jsonld';
import {UNIT_SPEC, bookingChannelLinks, primaryChannelLink, publicLinks, unitBaseRate} from '@site/seo/jsonld';
// 링크 거르기는 jsonld 에 산다(순환 의존 회피) — 화면 쪽은 늘 derive 를 통해 쓰므로 여기서 다시 낸다.
export {publicLinks};
export {publicLinks, primaryChannelLink};
/**
* payload → 화면이 바로 쓰는 모양.
@@ -477,23 +477,10 @@ function confirmedLinks(payload: SitePayload, channels: readonly number[]): Chan
* 예약 버튼에 낼 채널. **BOOKING_CHANNELS 순서대로** 정렬한다 — 예약 화면으로 바로 가는
* 채널이 맨 위 버튼이어야 한다.
*
* ★ 검색 결과 주소는 뺀다. 자동 발견이 `map.naver.com/p/search/…` 를 물어오는 경우가 있고
* (실측 2026-09-08), 그걸 "예약" 버튼에 걸면 손님이 검색 화면을 만난다 — 예약하러 온
* 사람에게 검색 결과를 주는 건 링크가 없는 것보다 나쁘다. 가게를 특정하지 못하는 주소라
* 애초에 예약 창구가 아니다.
* ★ 필터·순서 판단은 seo/jsonld 에 산다(순환 의존 회피, `bookingChannelLinks`) — 화면과
* makesOffer.url·potentialAction 이 같은 함수를 써야 어긋나지 않는다.
*/
export function bookingLinks(payload: SitePayload): ChannelLink[] {
const order = new Map(BOOKING_CHANNELS.map((channel, index) => [channel, index]));
return confirmedLinks(payload, BOOKING_CHANNELS)
.filter((link) => !isSearchUrl(link.url))
.sort((a, b) => (order.get(a.channel) ?? 99) - (order.get(b.channel) ?? 99));
}
/** 가게가 아니라 **검색 결과**를 가리키는 주소인지. */
function isSearchUrl(url: string): boolean {
return /\/p\/search\/|[?&]query=/.test(url);
}
export const bookingLinks = bookingChannelLinks;
/**
* ─────────────────────────────────────────────────────────────────────────
@@ -0,0 +1,28 @@
import {expect, it} from 'vitest';
import {condition} from './use-live-weather';
it('recognizes fog, showers and thunderstorms as distinct conditions', () => {
expect(condition(45)).toBe('안개');
expect(condition(48)).toBe('안개');
expect(condition(80)).toBe('소나기');
expect(condition(81)).toBe('소나기');
expect(condition(82)).toBe('소나기');
expect(condition(85)).toBe('소나기');
expect(condition(86)).toBe('소나기');
expect(condition(95)).toBe('뇌우');
expect(condition(96)).toBe('뇌우');
expect(condition(99)).toBe('뇌우');
});
it('splits rain into drizzle, normal, heavy and freezing', () => {
expect(condition(51)).toBe('이슬비');
expect(condition(53)).toBe('이슬비');
expect(condition(55)).toBe('이슬비');
expect(condition(61)).toBe('비');
expect(condition(63)).toBe('비');
expect(condition(65)).toBe('강한비');
expect(condition(56)).toBe('어는비');
expect(condition(57)).toBe('어는비');
expect(condition(66)).toBe('어는비');
expect(condition(67)).toBe('어는비');
});
+9 -2
View File
@@ -5,11 +5,18 @@ export interface LiveWeather extends WeatherSnapshot {
stale?: boolean;
}
function condition(code: number): string {
/** WMO weather code → 한 줄. ★ solution/backend/services/site_payload.py 의 _weather_condition() 과 같은 구간이어야 한다. */
export function condition(code: number): string {
if (code === 0) return '맑음';
if (code >= 1 && code <= 3) return '구름많음';
if (code >= 50 && code <= 69) return '비';
if (code === 45 || code === 48) return '안개';
if (code === 51 || code === 53 || code === 55) return '이슬비';
if (code === 56 || code === 57 || code === 66 || code === 67) return '어는비';
if (code === 61 || code === 63) return '비';
if (code === 65) return '강한비';
if (code >= 70 && code <= 79) return '눈';
if (code === 80 || code === 81 || code === 82 || code === 85 || code === 86) return '소나기';
if (code >= 95 && code <= 99) return '뇌우';
return '흐림';
}