Skip to content

fix(dashboard): 결품 집계에서 판정 제외(EXCLUDED) 품목 분리 — 128,250 중 63,930이 허수 - #69

Merged
choigod1023 merged 2 commits into
mainfrom
fix/stockout-exclude-not-operated
Aug 7, 2026
Merged

fix(dashboard): 결품 집계에서 판정 제외(EXCLUDED) 품목 분리 — 128,250 중 63,930이 허수#69
choigod1023 merged 2 commits into
mainfrom
fix/stockout-exclude-not-operated

Conversation

@choigod1023

Copy link
Copy Markdown
Contributor

Description

ai#38 반영 후 대시보드 결품 집계가 절반이 허수인 상태여서 고쳤습니다.
Related DGU-TeamLex/ai#38

inventory.statusEXCLUDED(판정 제외)가 생겼지만, stockoutItems 는 status 가 아니라 on_hand = 0 만 보고 세고 있었습니다. 그래서 해당 기관이 취급하지도 않는 품목이 그대로 결품으로 잡혔습니다.

지표 수정 전 수정 후
stockoutItems (실제 결품) 128,250 64,320
notOperatedItems (신설) 63,930
belowRopItems 157,278 157,278 (변화 없음)

수정 전 128,250 중 63,930(약 절반)이 미운영·데이터누락 품목이었습니다.

변경

  • stockoutItems = on_hand = 0 AND status <> 'EXCLUDED'
  • notOperatedItems 신설 = on_hand = 0 AND status = 'EXCLUDED' — 결품과 구분해 화면에 표기할 수 있게 별도 노출
  • REST(/dashboard)·GraphQL(CentralSummary) 양쪽에 반영
  • schema.sqlstatus 주석에 EXCLUDED 추가. 기존 주석이 "집계·정렬·프론트 라벨이 4값을 전제"라고 경고하고 있었는데, 그 경고가 가리키던 지점이 바로 이 집계였습니다. on_hand 기준 집계는 status 화이트리스트가 안 먹으니 별도로 걸러야 한다는 점을 명시했습니다.

Type

  • 버그 수정
  • 새로운 기능
  • UI/UX 변경
  • 리팩토링
  • 의존성 추가/수정

Screenshots

Before After
결품 128,250 (절반이 미운영 품목) 결품 64,320 + 미운영 63,930 분리

To Reviewer

운영 DB 로 수정 쿼리를 실행해 위 수치를 확인했고 py_compile 도 통과했습니다. 서버를 띄운 통합 테스트는 하지 않았습니다.

알림 계열 쿼리(/alerts/derived 등)는 status 화이트리스트(CRITICAL/BELOW_ROP)를 쓰고 있어 이미 자동으로 걸러지므로 손대지 않았습니다. 이번에 문제가 된 건 status 를 안 보고 on_hand 만 보던 집계 한 곳입니다.

frontend 에서 notOperatedItems 를 어떻게 보여줄지는 별도 판단이 필요합니다 — 결품 카드 옆에 부가 표기하거나, 툴팁으로 "미운영·데이터누락 63,930건 제외됨"을 붙이는 방식을 제안합니다.

PR Checklist

  • Commit Message Convention을 준수했습니다.
  • Code Convention을 준수했습니다.
  • 변경한 기능이 잘 동작하는지 테스트했습니다.

ai#38 로 inventory.status 에 EXCLUDED 가 생겼으나, 대시보드 stockoutItems 는
status 가 아니라 on_hand=0 만 보고 세고 있어 미운영·데이터누락 품목이 그대로
결품으로 잡혔다. 실측상 128,250 중 63,930(약 절반)이 허수였다.

- stockoutItems: on_hand=0 AND status<>'EXCLUDED' → 실제 결품 64,320
- notOperatedItems 신설: on_hand=0 AND status='EXCLUDED' → 63,930
- REST(/dashboard)·GraphQL(CentralSummary) 양쪽에 노출
- schema.sql 의 status 주석에 EXCLUDED 를 추가하고, on_hand 기준 집계는
  별도로 걸러야 한다는 점을 명시

검증: 운영 DB 로 수정 쿼리 실행해 위 수치 확인. py_compile 통과.

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
backend Ready Ready Preview Aug 7, 2026 2:42am

Request Review

@choigod1023
choigod1023 marked this pull request as ready for review August 7, 2026 02:41
@choigod1023
choigod1023 merged commit 03c2126 into main Aug 7, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants