Fix RFV period buyers with historical scoring
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m34s

This commit is contained in:
Cauê Faleiros
2026-06-17 15:07:59 -03:00
parent 10c69457ba
commit 3a907b0743
6 changed files with 89 additions and 48 deletions

View File

@@ -102,10 +102,11 @@ const Clients = () => {
const allClientsData = useMemo(() => {
const normalizedSearch = searchTerm.trim().toLowerCase();
const rfmByPhone = new Map((rfmAnalytics?.clients || []).map(client => [client.phone, client]));
const rfmByCustomerKey = new Map((rfmAnalytics?.clients || []).map(client => [client.customerKey, client]));
const clients = clientAnalytics.map((client): ClientSummary => {
const rfmClient = client.phone ? rfmByPhone.get(client.phone) : undefined;
const rfmClient = rfmByCustomerKey.get(client.customerKey);
return {
customerKey: client.customerKey,
name: client.name,
phone: client.phone,
totalSpent: client.totalSpent,
@@ -281,7 +282,7 @@ const Clients = () => {
</thead>
<tbody className="divide-y divide-zinc-100 dark:divide-dark-border">
{paginatedData.map((client, index) => (
<tr key={client.name} className="hover:bg-zinc-50/80 dark:hover:bg-dark-input/50 transition-colors group">
<tr key={client.customerKey} className="hover:bg-zinc-50/80 dark:hover:bg-dark-input/50 transition-colors group">
<td className="px-6 py-2.5">
<span className="inline-flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold bg-zinc-100 dark:bg-dark-border text-zinc-500 dark:text-dark-muted">
{startIndex + index + 1}