rohitsar567 Claude Opus 4.7 (1M context) commited on
Commit
1e171b7
Β·
1 Parent(s): 06c7cbc

fix(#76): show the customer's chosen cover, not 'As per policy schedule'

Browse files

When a plan publishes no fixed SI tiers the premium IS already priced at
the customer's desired_sum_insured_inr, but the Cover-amount row still
rendered the dismissive 'As per policy schedule' placeholder β€” looking
like the customer's stated cover was ignored. SnapProfile now carries
desired_sum_insured_inr (the live profile already provides it; build
green) and buildSnapshot overrides the placeholder with
'β‚ΉX (your chosen cover)' ONLY when the plan has no published SI AND the
customer gave one β€” otherwise unchanged. fmtSumInsured signature
untouched (used elsewhere).

tsc clean; frontend build Compiled successfully.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

frontend/src/components/PolicyCompareModal.tsx CHANGED
@@ -888,6 +888,11 @@ export type SnapProfile = {
888
  primary_goal?: string | null;
889
  age?: number | null;
890
  health_conditions?: string[] | null;
 
 
 
 
 
891
  } | null;
892
 
893
  export function buildSnapshot(
@@ -937,7 +942,20 @@ export function buildSnapshot(
937
 
938
  // 1 β€” WHAT YOU GET
939
  const get: SnapRow[] = [];
940
- get.push({ label: "Cover amount", value: fmtSumInsured(policy), term: "cover" });
 
 
 
 
 
 
 
 
 
 
 
 
 
941
  push(
942
  get,
943
  "No-claim bonus",
 
888
  primary_goal?: string | null;
889
  age?: number | null;
890
  health_conditions?: string[] | null;
891
+ // #76 β€” the customer's stated/selected cover. When a plan doesn't
892
+ // publish fixed SI tiers we price at THIS and must show it, not the
893
+ // dismissive "As per policy schedule" (which looks like their input
894
+ // was ignored).
895
+ desired_sum_insured_inr?: number | null;
896
  } | null;
897
 
898
  export function buildSnapshot(
 
942
 
943
  // 1 β€” WHAT YOU GET
944
  const get: SnapRow[] = [];
945
+ // #76 β€” when the plan publishes no fixed SI ("As per policy schedule")
946
+ // BUT the customer stated/selected a cover, the premium IS priced at
947
+ // their cover β€” so show it, with a clear label, instead of the
948
+ // dismissive placeholder that reads as if their input was discarded.
949
+ let _coverVal = fmtSumInsured(policy);
950
+ const _custSI = profile?.desired_sum_insured_inr;
951
+ if (_coverVal === "As per policy schedule" && _custSI && _custSI > 0) {
952
+ const _c =
953
+ _custSI >= 10_000_000
954
+ ? `${+(_custSI / 10_000_000).toFixed(1)} Cr`
955
+ : `${+(_custSI / 100_000).toFixed(1)} L`;
956
+ _coverVal = `β‚Ή${_c} (your chosen cover)`;
957
+ }
958
+ get.push({ label: "Cover amount", value: _coverVal, term: "cover" });
959
  push(
960
  get,
961
  "No-claim bonus",