From 50adedf48ee4674ebe00f1ee72d93485183cdc51 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 5 Sep 2025 11:44:32 +0000 Subject: (대표님, 최겸, 임수민) EDP 입력 진행률, 견적목록관리, EDP excel import 오류수정, GTC-Contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/forms/stat.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/forms/stat.ts') diff --git a/lib/forms/stat.ts b/lib/forms/stat.ts index fbcc6f46..45bf2710 100644 --- a/lib/forms/stat.ts +++ b/lib/forms/stat.ts @@ -20,11 +20,12 @@ export async function getVendorFormStatus(): Promise { try { // 1. 모든 벤더 조회 const vendorList = await db - .select({ - id: vendors.id, - vendorName: vendors.vendorName - }) - .from(vendors) + .selectDistinct({ + vendorId: vendors.id, + vendorName: vendors.vendorName, + }) + .from(vendors) + .innerJoin(contracts, eq(contracts.vendorId, vendors.id)) const vendorStatusList: VendorFormStatus[] = [] @@ -37,12 +38,12 @@ export async function getVendorFormStatus(): Promise { // 2. 벤더별 계약 조회 const vendorContracts = await db - .selectDistinct({ - vendorId: vendors.id, - vendorName: vendors.vendorName, - }) - .from(vendors) - .innerJoin(contracts, eq(contracts.vendorId, vendors.id)) + .select({ + id: contracts.id, + projectId: contracts.projectId + }) + .from(contracts) + .where(eq(contracts.vendorId, vendor.vendorId)) for (const contract of vendorContracts) { // 3. 계약별 contractItems 조회 @@ -119,8 +120,7 @@ export async function getVendorFormStatus(): Promise { // 최종 입력 필요 필드 = shi 기반 필드 + TAG 기반 편집 가능 필드 const allRequiredFields = inputRequiredFields.filter(field => tagEditableFields.includes(field) - ) - + ) // 각 필드별 입력 상태 체크 for (const fieldKey of allRequiredFields) { vendorTotalFields++ @@ -143,7 +143,7 @@ export async function getVendorFormStatus(): Promise { : 0 vendorStatusList.push({ - vendorId: vendor.id, + vendorId: vendor.vendorId, vendorName: vendor.vendorName || '이름 없음', formCount: vendorFormCount, tagCount: uniqueTags.size, -- cgit v1.2.3