From d7d1872db64f2d55be834270b83d2de0df43a6da Mon Sep 17 00:00:00 2001 From: "hangyu.tao" Date: Thu, 15 Jan 2026 14:47:56 +0800 Subject: [PATCH] fix_followup --- internal/handlers/followup_handler.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/handlers/followup_handler.go b/internal/handlers/followup_handler.go index 86f5c89..fd26f40 100644 --- a/internal/handlers/followup_handler.go +++ b/internal/handlers/followup_handler.go @@ -277,15 +277,17 @@ func (h *FollowUpHandler) GetCustomerList(w http.ResponseWriter, r *http.Request CustomerName string `json:"customerName"` } - // Return all customers (including duplicates with same name but different IDs) - // This is needed so that trial periods can map all customer IDs to names + // Deduplicate by customer name - only show each unique customer name once in dropdown + // Use a map to track which customer names we've already added + seenNames := make(map[string]bool) var customerList []CustomerInfo for _, customer := range customers { - if customer.CustomerName != "" { + if customer.CustomerName != "" && !seenNames[customer.CustomerName] { customerList = append(customerList, CustomerInfo{ ID: customer.ID, CustomerName: customer.CustomerName, }) + seenNames[customer.CustomerName] = true fmt.Printf("DEBUG: Added customer: ID=%s, Name=%s\n", customer.ID, customer.CustomerName) } }