Merge pull request 'fix: 라이브 어구 현황 fallback 제외 + FLEET resolution' (#216) from bugfix/fleet-resolution-fix into develop
This commit is contained in:
커밋
acef08fca9
@ -2,7 +2,7 @@
|
||||
-- 기존 데이터는 DEFAULT '6h'로 취급
|
||||
|
||||
ALTER TABLE kcg.group_polygon_snapshots
|
||||
ADD COLUMN IF NOT EXISTS resolution VARCHAR(4) DEFAULT '6h';
|
||||
ADD COLUMN IF NOT EXISTS resolution VARCHAR(8) DEFAULT '6h';
|
||||
|
||||
-- 기존 인덱스 교체: resolution 포함
|
||||
DROP INDEX IF EXISTS kcg.idx_gps_type_time;
|
||||
|
||||
@ -180,7 +180,7 @@ export function FleetClusterLayer({ ships, analysisMap: analysisMapProp, onShipS
|
||||
]);
|
||||
|
||||
// 2. resolution별 분리 → 1h(primary) + 6h(secondary)
|
||||
const history1h = history.filter(h => h.resolution === '1h');
|
||||
const history1h = history.filter(h => h.resolution === '1h' || h.resolution === '1h-fb');
|
||||
const history6h = history.filter(h => h.resolution === '6h');
|
||||
// fallback: resolution 필드 없는 기존 데이터는 6h로 취급
|
||||
const effective1h = history1h.length > 0 ? history1h : history;
|
||||
|
||||
@ -399,6 +399,7 @@ def build_all_group_snapshots(
|
||||
'group_type': 'FLEET',
|
||||
'group_key': str(company_id),
|
||||
'group_label': group_label,
|
||||
'resolution': '1h',
|
||||
'snapshot_time': now,
|
||||
'polygon_wkt': polygon_wkt,
|
||||
'center_wkt': center_wkt,
|
||||
@ -422,12 +423,16 @@ def build_all_group_snapshots(
|
||||
continue
|
||||
|
||||
# ── 1h 활성 멤버 필터 ──
|
||||
display_members_1h = [
|
||||
active_members_1h = [
|
||||
gm for gm in gear_members
|
||||
if _get_time_bucket_age(gm.get('mmsi'), all_positions, now) <= DISPLAY_STALE_SEC
|
||||
]
|
||||
# fallback: 1h < 2이면 time_bucket 최신 2개 유지 (폴리곤 형태 보존)
|
||||
if len(display_members_1h) < 2 and len(gear_members) >= 2:
|
||||
active_count_1h = len(active_members_1h)
|
||||
|
||||
# fallback: 1h < 2이면 time_bucket 최신 2개 유지 (리플레이/일치율 추적용)
|
||||
# 라이브 현황에서는 active_count_1h로 필터 (fallback 그룹 제외)
|
||||
display_members_1h = active_members_1h
|
||||
if active_count_1h < 2 and len(gear_members) >= 2:
|
||||
sorted_by_age = sorted(
|
||||
gear_members,
|
||||
key=lambda gm: _get_time_bucket_age(gm.get('mmsi'), all_positions, now),
|
||||
@ -442,7 +447,9 @@ def build_all_group_snapshots(
|
||||
display_members_6h = gear_members
|
||||
|
||||
# ── resolution별 스냅샷 생성 ──
|
||||
for resolution, members_for_snap in [('1h', display_members_1h), ('6h', display_members_6h)]:
|
||||
# 1h-fb: fallback (실제 1h 활성 < 2) — 리플레이/일치율 추적용, 라이브 현황에서 제외
|
||||
res_1h = '1h' if active_count_1h >= 2 else '1h-fb'
|
||||
for resolution, members_for_snap in [(res_1h, display_members_1h), ('6h', display_members_6h)]:
|
||||
if len(members_for_snap) < 2:
|
||||
continue
|
||||
# 6h: 최신 적재가 STALE_SEC(6h) 초과 시 스킵
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user