fix_followup

This commit is contained in:
hangyu.tao 2026-01-15 14:47:56 +08:00
parent 3b1f94f287
commit d7d1872db6

View File

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