fix(legacy-stage): purge 9-stage enum keys from rank tables and stale copy
L-001 hunt landed these:
- src/lib/services/clients.service.ts — stageRank used pre-refactor
9-stage names exclusively (`contract_signed`, `deposit_10pct`, …).
Every modern 7-stage interest fell to rank 0, making client-list
"most-progressed deal" sort effectively random. Modern values now
own the canonical ranks; legacy aliases map to their 7-stage
equivalents so historical audit data still sorts.
- src/lib/services/berth-recommender.service.ts — STAGE_ORDER had
the same 9-stage shape. LATE_STAGE_THRESHOLD pointed at the (now
nonexistent) `deposit_10pct` slot. Reworked to the 7-stage scale;
threshold now at `deposit_paid` (5).
- Stale comments referencing `deposit_10pct` in schema (clients,
financial) and client-archive services updated to current copy.
- Smart-archive dialog rendered `i.pipelineStage` as raw enum; now
routes through `stageLabelFor` (the new helper added with A2).
Test fixture updates: berth-recommender.test.ts numeric inputs
re-mapped to the new 7-stage scale (eoi_signed=5 → eoi=3, etc.).
1373/1373 vitest pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,18 +13,21 @@ describe('classifyTier', () => {
|
||||
it('"B" when only lost interests exist (no active)', () => {
|
||||
expect(classifyTier({ activeInterestCount: 0, lostCount: 2, maxActiveStage: 0 })).toBe('B');
|
||||
});
|
||||
it('"C" when an active interest is in an early stage', () => {
|
||||
// L-001 renumber: 7-stage ranks are 1=enquiry, 2=qualified/nurturing,
|
||||
// 3=eoi, 4=reservation, 5=deposit_paid, 6=contract. Tier D fires at
|
||||
// deposit_paid (5) or later.
|
||||
it('"C" when an active interest is in an early stage (eoi)', () => {
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 3 })).toBe('C');
|
||||
});
|
||||
it('"C" even when a prior interest was lost, if there is an active one', () => {
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 5, maxActiveStage: 2 })).toBe('C');
|
||||
});
|
||||
it('"D" when an active interest is at deposit or beyond', () => {
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 5 })).toBe('D');
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 6 })).toBe('D');
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 8 })).toBe('D');
|
||||
});
|
||||
it('still "C" at eoi_signed (stage 5) - tier D only kicks in at deposit', () => {
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 5 })).toBe('C');
|
||||
it('still "C" at reservation (stage 4) - tier D only kicks in at deposit', () => {
|
||||
expect(classifyTier({ activeInterestCount: 1, lostCount: 0, maxActiveStage: 4 })).toBe('C');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,7 +84,7 @@ describe('computeHeat', () => {
|
||||
latestFallthroughAt: null,
|
||||
totalInterestCount: 0,
|
||||
eoiSignedCount: 0,
|
||||
fallthroughMaxStage: 6, // deposit_10pct
|
||||
fallthroughMaxStage: 5, // deposit_paid (was deposit_10pct=6 pre-refactor)
|
||||
},
|
||||
w,
|
||||
NOW,
|
||||
|
||||
Reference in New Issue
Block a user