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) } }