product performance grouped kpi improvements

This commit is contained in:
M_Kececi
2026-07-03 03:43:17 +03:00
parent 94c83c3825
commit a05e6bf1e2
2 changed files with 42 additions and 8 deletions
@@ -3844,10 +3844,12 @@ async function loadBackendGroupedRows () {
}
function normalizeGroupedDisplayRow (tabKey, row) {
const nextRow = { ...row }
normalizeGroupedProductHierarchyValues(nextRow)
if (tabKey === 'order_product_customers' || tabKey === 'order_market_details') {
return withOrderPeriodScores({ ...row })
return withOrderPeriodScores(nextRow)
}
const next = withPeriodScores({ ...row })
const next = withPeriodScores(nextRow)
if (tabKey !== 'products' && tabKey !== 'idle') {
next.customer_score_90d = Number(next.customer_score_90d || customerSalesPeriodScore(periodMetricSource(next, '90d')))
next.customer_score_180d = Number(next.customer_score_180d || customerSalesPeriodScore(periodMetricSource(next, '180d')))
@@ -3857,6 +3859,17 @@ function normalizeGroupedDisplayRow (tabKey, row) {
return next
}
function normalizeGroupedProductHierarchyValues (row) {
row.urun_ilk_grubu = cleanProductFirstGroupValue(row.urun_ilk_grubu)
if (row.__group && row.group_field === 'urun_ilk_grubu') {
const cleanValue = cleanProductFirstGroupValue(row.group_value || row.label || row.urun_ilk_grubu)
row.group_value = cleanValue
row.label = cleanValue
row.urun_ilk_grubu = cleanValue
}
return row
}
function responseRowCount (data) {
if (Array.isArray(data)) return data.length
if (Array.isArray(data?.rows)) return data.rows.length