mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
fix(call-desk): overlay resolver patientId onto worklist lead
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Pair to worklist.service.ts change. Unknown caller → appointment booked (creates Patient) → caller rings back → resolver links Lead↔Patient. But the frontend sometimes found the lead in the worklist cache mid-30s-poll and that row's patientId hadn't refreshed yet — so leadAppointments filter (keyed on lead.patientId) came up empty and the Book Appt pill for the prior appointment didn't render. Now: when the worklist row is used, overlay the resolver's patientId if the cached row's is missing. Belt-and-braces with the sidecar fix.
This commit is contained in:
@@ -108,9 +108,17 @@ export const CallDeskPage = () => {
|
|||||||
}
|
}
|
||||||
}, [isInCall]);
|
}, [isInCall]);
|
||||||
|
|
||||||
// Build activeLead from resolved caller or fallback to client-side match
|
// Build activeLead from resolved caller or fallback to client-side match.
|
||||||
|
// The resolver is the authoritative source for patientId (it just joined
|
||||||
|
// lead↔patient by phone), so overlay it on top of any worklist row that
|
||||||
|
// pre-dates the linkage. Without this, the Book Appt pills can't find
|
||||||
|
// a returning caller's prior appointments because the frontend loses
|
||||||
|
// sight of which patient they are.
|
||||||
|
const workLead = resolvedCaller ? marketingLeads.find((l) => l.id === resolvedCaller.leadId) : null;
|
||||||
const callerLead = resolvedCaller
|
const callerLead = resolvedCaller
|
||||||
? marketingLeads.find((l) => l.id === resolvedCaller.leadId) ?? {
|
? workLead
|
||||||
|
? { ...workLead, patientId: (workLead as any).patientId ?? resolvedCaller.patientId }
|
||||||
|
: {
|
||||||
id: resolvedCaller.leadId,
|
id: resolvedCaller.leadId,
|
||||||
contactName: { firstName: resolvedCaller.firstName, lastName: resolvedCaller.lastName },
|
contactName: { firstName: resolvedCaller.firstName, lastName: resolvedCaller.lastName },
|
||||||
contactPhone: [{ number: resolvedCaller.phone, callingCode: '+91' }],
|
contactPhone: [{ number: resolvedCaller.phone, callingCode: '+91' }],
|
||||||
|
|||||||
Reference in New Issue
Block a user