mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-27 22:45:03 +00:00
refactor(live): remove the dead majorConditionDeals plumbing
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) <noreply@anthropic.com>
This commit is contained in:
parent
ae6a6ebf68
commit
7cf6316431
5 changed files with 0 additions and 33 deletions
|
|
@ -311,7 +311,6 @@ interface AnalyticsViewProps {
|
|||
columnLabels?: Partial<Record<keyof ClassifiedDeal, string>>,
|
||||
breakdown?: Record<string, ClassifiedDeal[]>,
|
||||
) => void;
|
||||
majorConditionDeals: ClassifiedDeal[];
|
||||
totalDeals: number;
|
||||
availableGroups: GroupNode[];
|
||||
groupFilter: string[];
|
||||
|
|
@ -325,7 +324,6 @@ export default function AnalyticsView({
|
|||
currentProjectCode,
|
||||
onProjectChange,
|
||||
onOpenTable,
|
||||
majorConditionDeals,
|
||||
totalDeals,
|
||||
availableGroups,
|
||||
groupFilter,
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -657,28 +657,6 @@ describe("computeLiveTrackerData", () => {
|
|||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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<string, ClassifiedDeal[]> = {};
|
||||
for (const deal of classified) {
|
||||
|
|
@ -319,6 +313,5 @@ export function computeLiveTrackerData(
|
|||
return {
|
||||
projects,
|
||||
totalDeals: classified.length,
|
||||
majorConditionDeals,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ export type InstructedMeasuresByDeal = Record<string, string[]>;
|
|||
export type LiveTrackerProps = {
|
||||
projects: ProjectData[];
|
||||
totalDeals: number;
|
||||
majorConditionDeals: ClassifiedDeal[]; // for Awaab's Law card
|
||||
docStatusMap: DocStatusMap;
|
||||
userCapability: PortfolioCapabilityType;
|
||||
approvalsByDeal: ApprovalsByDeal;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue