From c533bb3e80d326557036af22adf2f09ad8a97aac Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 19 May 2026 10:35:15 +0000 Subject: [PATCH] specify certain variables as survey --- .../live/PropertyDocumentsContent.tsx | 16 ++++++++-------- .../your-projects/live/propertyDocuments.test.ts | 10 +++++----- .../your-projects/live/propertyDocuments.ts | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/PropertyDocumentsContent.tsx b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/PropertyDocumentsContent.tsx index 50a9410..f8ff6d5 100644 --- a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/PropertyDocumentsContent.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/PropertyDocumentsContent.tsx @@ -16,7 +16,7 @@ import { } from "lucide-react"; import type { PropertyDocument, DocStatus } from "./types"; import { EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES } from "./types"; -import { splitDocumentsByType, getMissingRetrofitTypes, getUnassignedInstallDocs } from "./propertyDocuments"; +import { splitDocumentsByType, getMissingSurveyDocTypes, getUnassignedInstallDocs } from "./propertyDocuments"; import ContractorUploadModal from "./ContractorUploadModal"; import type { ClassifiedDeal, PortfolioCapabilityType } from "./types"; @@ -176,7 +176,7 @@ export default function PropertyDocumentsContent({ }); const { docs: surveyDocs, coordinationDocs, designDocs, installDocs } = splitDocumentsByType(documents); - const missingRetrofitTypes = getMissingRetrofitTypes(surveyDocs); + const missingSurveyDocTypes = getMissingSurveyDocTypes(surveyDocs); const hasDocuments = documents.length > 0; const isContractor = userCapability?.includes("contractor") ?? false; @@ -235,9 +235,9 @@ export default function PropertyDocumentsContent({

- Missing Documents ({missingRetrofitTypes.length}) + Missing Documents ({missingSurveyDocTypes.length})

- {missingRetrofitTypes.map((t) => ( + {missingSurveyDocTypes.map((t) => (
{/* Retrofit Assessment */} - +

Retrofit Assessment Documents

@@ -270,12 +270,12 @@ export default function PropertyDocumentsContent({ ) : (

None uploaded yet.

)} - {missingRetrofitTypes.length > 0 && ( + {missingSurveyDocTypes.length > 0 && (

- Missing ({missingRetrofitTypes.length}) + Missing ({missingSurveyDocTypes.length})

- {missingRetrofitTypes.map((t) => ( + {missingSurveyDocTypes.map((t) => (
{ describe("getMissingRetrofitTypes", () => { it("returns all mandatory types when no docs uploaded", () => { - const missing = getMissingRetrofitTypes([]); + const missing = getMissingSurveyDocTypes([]); expect(missing).toHaveLength(9); }); it("excludes types that have been uploaded", () => { const uploaded = [makeDoc({ docType: "photo_pack" })]; - const missing = getMissingRetrofitTypes(uploaded); + const missing = getMissingSurveyDocTypes(uploaded); expect(missing).not.toContain("photo_pack"); expect(missing).toHaveLength(8); }); @@ -91,12 +91,12 @@ describe("getMissingRetrofitTypes", () => { "pas_2023_condition", "pas_significance", "par_photo_pack", "pas_2023_property", "pas_2023_occupancy", ].map((docType, i) => makeDoc({ id: String(i), docType })); - expect(getMissingRetrofitTypes(uploaded)).toHaveLength(0); + expect(getMissingSurveyDocTypes(uploaded)).toHaveLength(0); }); it("does not count ecmk types as mandatory", () => { const uploaded = [makeDoc({ docType: "ecmk_site_note" })]; - const missing = getMissingRetrofitTypes(uploaded); + const missing = getMissingSurveyDocTypes(uploaded); expect(missing).not.toContain("ecmk_site_note"); expect(missing).toHaveLength(9); }); diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/propertyDocuments.ts b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/propertyDocuments.ts index f8f3cae..e9ebf41 100644 --- a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/propertyDocuments.ts +++ b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/propertyDocuments.ts @@ -25,8 +25,8 @@ export function splitDocumentsByType(docs: PropertyDocument[]): { }; } -export function getMissingRetrofitTypes(retrofitDocs: PropertyDocument[]): string[] { - const present = new Set(retrofitDocs.map((d) => d.docType)); +export function getMissingSurveyDocTypes(surveyDocs: PropertyDocument[]): string[] { + const present = new Set(surveyDocs.map((d) => d.docType)); return EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES.filter((t) => !present.has(t)); }