Subversion Repositories SmartDukaan

Rev

Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37784 11 d 10 h vikas /trunk/ Corrected LMS Data and Added filter  
37759 13 d 6 h vikas /trunk/ LMS Call for App  
37749 13 d 7 h vikas /trunk/ Upload directory and Data correction for lead  
37737 15 d 12 h vikas /trunk/ LMS checklist for call  
37729 15 d 13 h amit /trunk/ lead: one workable lead per mobile, with a 6-month supersede and an L2+ override

There was no choke point for lead creation. Ten sites did `new Lead()` across four
modules -- three in web's LeadController, two in V2FofoLeadController, three in fofo's
LeadController, one in TrialServiceImpl and one in the cron LeadSyncRunner -- and only
ONE of them (fofo /createLead) checked for an existing lead at all. Result on live data:
5,137 mobiles carrying duplicate leads over 12,156 rows, worst case 29 on one number,
and two agents unknowingly working the same shop.

THE RULE, in new LeadCreationService, which all ten now route through:

no active lead on the number -> create
active, last activity >= 6 months -> retire the old one, create the new one, SILENTLY
active, last activity < 6 months -> BLOCK; only an L2+ user may override

Active = status in (pending, followUp) AND the assignee is still an active auth_user.
Last activity = GREATEST(lead.updated/created, MAX(lead_activity.created)).

The stale branch is deliberately quiet. A shop enquiring again after six months is a
handover, not a clash, and mailing on it would train the desk to ignore the alert -- so
only a genuine collision notifies. Live split: 195 stale against 1,241 fresh, and roughly
three blocks a month.

WHY "ACTIVE" ALSO MEANS A LIVE OWNER

331 open leads are assigned to 11 DEACTIVATED accounts (157 to sm@smartdukaan.com alone,
whose newest lead is from 2022). Counting them as active would block fresh enquiries
behind an account nobody can log in to and therefore nobody can close. Requiring a live
owner defuses all 331 without retiring a single row. Retirement here is only ever
REACTIVE -- triggered by a new entry on the same number. Nothing runs on a schedule.

ASSUMPTION worth flagging: a superseded lead becomes status=notInterested (stage DROPPED)
with closure_timestamp and reason 'Superseded after 6 months inactivity', rather than a
new `expired` status. "Closed" is an explicit allow-list in the UI --
Arrays.asList(notInterested, finalized) at V2FofoLeadController:150 and fofo
LeadController:313 -- and there are ~107 references to specific LeadStatus values, so a
new enum value would make these leads vanish from BOTH the open and closed screens.
Stage DROPPED keeps the nuance (the shop never said no) and still maps to notInterested
via LeadStage.toLegacyStatus().

OVERRIDE is L2+ in ANY team, not Call Center only: Sales L1 owns 1,063 of the 1,776 open
leads, so a Call-Center-only gate would funnel every team's collisions through three
people. The MAIL still goes to Call Center L2+, resolved from cs.position at send time
rather than hardcoded. An override is a TAKEOVER -- it closes the existing lead -- because
a second live lead is the exact thing the rule exists to prevent.

UNATTENDED CALLERS (cron sync, CSV upload, trial registration, AI intake) have nobody to
offer an override to, so they use createUnattended: skip the colliding row and mail the
desk rather than throwing. CSV reports imported/duplicateSkipped/duplicateMobiles back to
the operator instead of failing the whole file over one number.

ALSO FIXES selectByMobileNumber, which called getSingleResult and therefore threw
NonUniqueResultException on any mobile with more than one lead -- GlitchTip #99 and #1359,
both still firing. It now prefers the open lead, then the most recently touched.

NOT INCLUDED, deliberately: no DB unique constraint. 10 mobiles already carry more than
one open lead and would have to be resolved by hand first, which conflicts with the
no-auto-retirement rule. The service enforces the invariant going forward.

NEEDS A DBA STEP: user.lead.mobile is unindexed on 37,580 rows, so this check is a full
scan on every create. Index DDL is in the accompanying note; it has NOT been applied.
 
37692 19 d 7 h vikas /trunk/ LMS + Airtel Calling  
37651 20 d 10 h vikas /trunk/ LMS click to call  
37120 81 d 8 h vikas /trunk/ Added leads in Beat Creation  
36984 97 d 7 h aman /trunk/ Lead Management: (1) fix date-range CSV download to mirror the on-screen view - all statuses in range PLUS follow-ups - so it no longer returns empty or 500s on empty windows; guard empty result set. (2) Add global lead search (name/mobile/outlet/city across ALL leads, any status/date) wired to the existing lead-table search box (Enter = search all). Bump JS cache version to 369.  
36957 98 d 12 h aman /trunk/ Add AI assistant lead intake endpoint (POST /add/lead) tagging source=AI Assistant in Lead Management  
35769 232 d 9 h amit /trunk/ Lead management fixes: date range filter, schedule timestamp from latest activity, source in edit lead

- Replace single date filter with start/end date range (max 6 months) in getOpenLead and downloadDateWiseLead
- Add new repository methods for date range queries with color/status/authIds filtering
- Fix selectLeadsScheduledBetweenDate SQL to use schedule_timestamp from latest-created activity instead of MAX(schedule_timestamp)
- Add source field to edit lead modal, CreateLeacdActivityRequest model, and EditLead controller
- Bump jsVersion to 318
 
35507 279 d 10 h ranu /trunk/ lead repo done  
35079 375 d 13 h vikas /trunk/ Live Tracking and Shopify Products List Sync  
34894 412 d 10 h aman /trunk/ Fix:Download lead report by created timestamp  
34621 495 d 10 h aman.kumar /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ Fixing duplicate input errors in Lead Assign  
33246 899 d 12 h ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/ added signature also  
32471 1111 d 10 h tejbeer /trunk/  
31249 1394 d 14 h tejbeer /trunk/ visit changes  
29435 1818 d 13 h amit.gupta /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/  
29425 1819 d 7 h manish /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/dtr/ commit  

Show All