diff options
Diffstat (limited to 'lib/swp/document-service.ts')
| -rw-r--r-- | lib/swp/document-service.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/swp/document-service.ts b/lib/swp/document-service.ts index f83488d9..32126676 100644 --- a/lib/swp/document-service.ts +++ b/lib/swp/document-service.ts @@ -200,14 +200,17 @@ export async function getDocumentList( // 문서에 파일 통계 추가 const result = documents.map((doc) => { - const files = filesByDoc.get(doc.DOC_NO) || []; - const standbyFiles = files.filter((f) => f.STAT === "SCW01"); + const allFiles = filesByDoc.get(doc.DOC_NO) || []; + + // 최신 REV의 파일만 필터링 + const latestRevFiles = allFiles.filter((f) => f.REV_NO === doc.LTST_REV_NO); + const standbyFiles = latestRevFiles.filter((f) => f.STAT === "SCW01"); return { ...doc, - fileCount: files.length, + fileCount: latestRevFiles.length, standbyFileCount: standbyFiles.length, - latestFiles: files + latestFiles: latestRevFiles .sort((a, b) => b.CRTE_DTM.localeCompare(a.CRTE_DTM)) .slice(0, 5), // 최신 5개만 }; |
