From 7cf6316431c903d529d2be540d6ce54d26b93023 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 20 Jul 2026 17:10:33 +0100 Subject: [PATCH] refactor(live): remove the dead majorConditionDeals plumbing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit majorConditionDeals was computed in computeLiveTrackerData and threaded through LiveTrackerProps → LiveTracker → AnalyticsView, but never rendered — the intended "Awaab's Law card" was never built. With the rendered "Flagged at Survey" count now keyed on the same hasMajorConditionIssue signal, this set is redundant. Removed the const, the LiveTrackerProps field, the prop plumbing in LiveTracker + AnalyticsView, and its two tests. hasMajorConditionIssue stays (used by the survey-flag count). Typecheck + lint clean; live-tracker tests (64) + full suite (500) green. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../your-projects/live/AnalyticsView.tsx | 2 -- .../your-projects/live/LiveTracker.tsx | Bin 22596 -> 22517 bytes .../your-projects/live/transforms.test.ts | 23 ------------------ .../your-projects/live/transforms.ts | 7 ------ .../(portfolio)/your-projects/live/types.ts | 1 - 5 files changed, 33 deletions(-) diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/AnalyticsView.tsx b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/AnalyticsView.tsx index b41971b9..3c1c3fe1 100644 --- a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/AnalyticsView.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/AnalyticsView.tsx @@ -311,7 +311,6 @@ interface AnalyticsViewProps { columnLabels?: Partial>, breakdown?: Record, ) => void; - majorConditionDeals: ClassifiedDeal[]; totalDeals: number; availableGroups: GroupNode[]; groupFilter: string[]; @@ -325,7 +324,6 @@ export default function AnalyticsView({ currentProjectCode, onProjectChange, onOpenTable, - majorConditionDeals, totalDeals, availableGroups, groupFilter, diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/LiveTracker.tsx b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/LiveTracker.tsx index 1318ba79ed38b546e3b05ad1595d93534d108063..dc0744ea8194a5d224b9df69c0ce8a1abaeeeba9 100644 GIT binary patch delta 19 bcmX@If${5l#to-fH$P;p*4#Wre}e`9Vw4Fb delta 75 zcmeymp7F>A#to-f`EnDp@{64F^HMTPGV}8`A7pLO)Ib$;NlnZtwynk@xY< { expect(computeLiveTrackerData(deals).totalDeals).toBe(3); }); - it("selects majorConditionDeals by a flagged issue, regardless of dealstage", () => { - // Regression: the major-condition stage (3061261536) was retired in HubSpot, - // so a flagged deal now sits in some other stage. It must still be selected. - const deals = [ - makeDeal({ - dealstage: "1617223910", // any current stage, not the retired one - majorConditionIssueDescription: "Damp in bathroom", - }), - makeDeal({ dealstage: "1617223910" }), // no issue flagged - ]; - const result = computeLiveTrackerData(deals); - expect(result.majorConditionDeals).toHaveLength(1); - expect(result.majorConditionDeals[0].majorConditionIssueDescription).toBe( - "Damp in bathroom", - ); - }); - - it("does not select a deal on the retired stage id alone (no issue flagged)", () => { - const deals = [makeDeal({ dealstage: "3061261536" })]; - expect(computeLiveTrackerData(deals).majorConditionDeals).toHaveLength(0); - }); - it("groups deals without a projectCode under Unknown Project", () => { const deals = [makeDeal({ projectCode: null })]; const result = computeLiveTrackerData(deals); @@ -689,7 +667,6 @@ describe("computeLiveTrackerData", () => { const result = computeLiveTrackerData([]); expect(result.projects).toHaveLength(0); expect(result.totalDeals).toBe(0); - expect(result.majorConditionDeals).toHaveLength(0); }); }); diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/transforms.ts b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/transforms.ts index 035fe40f..8804a506 100644 --- a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/transforms.ts +++ b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/transforms.ts @@ -285,12 +285,6 @@ export function computeLiveTrackerData( // Classify all deals (add displayStage field) const classified = classifyDeals(rawDeals); - // Filter for major condition deals (Awaab's Law). Keyed on the flagged issue, - // not the deal's pipeline stage: the old "Major condition issue" HubSpot stage - // was retired, so flagged deals now sit in whatever stage they've progressed - // to. A deal counts when the assessor recorded a major condition issue. - const majorConditionDeals = classified.filter(hasMajorConditionIssue); - // Group deals by projectCode const grouped: Record = {}; for (const deal of classified) { @@ -319,6 +313,5 @@ export function computeLiveTrackerData( return { projects, totalDeals: classified.length, - majorConditionDeals, }; } diff --git a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/types.ts b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/types.ts index 9017a802..1d751ea2 100644 --- a/src/app/portfolio/[slug]/(portfolio)/your-projects/live/types.ts +++ b/src/app/portfolio/[slug]/(portfolio)/your-projects/live/types.ts @@ -204,7 +204,6 @@ export type InstructedMeasuresByDeal = Record; export type LiveTrackerProps = { projects: ProjectData[]; totalDeals: number; - majorConditionDeals: ClassifiedDeal[]; // for Awaab's Law card docStatusMap: DocStatusMap; userCapability: PortfolioCapabilityType; approvalsByDeal: ApprovalsByDeal;