Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-19 01:10:20 +03:00
parent ba9a744aef
commit db13574e9d
@@ -469,7 +469,7 @@
</span>
</div>
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
<span class="pcd-group-total-text">
<span class="pcd-group-total-text" data-no-runtime-i18n="true">
Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }}
<span class="pcd-group-total-divider">|</span>
USD: {{ formatBarMoney(grp.usdTotal) }}
@@ -2936,66 +2936,20 @@ const detailGroupsWithTotals = computed(() => (
detailGroups.value.map(group => {
const items = Array.isArray(group?.items) ? group.items : []
const totals = items.reduce((acc, row) => {
acc.rawTryTotal += parseMoneyInput(row?.lTutar)
acc.liveTryTotal += resolveRowTRYTutar(row)
if (!shouldIncludeRowInGroupTotal(group, row)) return acc
acc.includedCount += 1
acc.tryTotal += resolveGroupRowTRYAmount(row)
acc.usdTotal += resolveGroupRowUSDAmount(row)
return acc
}, { tryTotal: 0, usdTotal: 0, rawTryTotal: 0, liveTryTotal: 0, includedCount: 0 })
}, { tryTotal: 0, usdTotal: 0 })
return {
...group,
tryTotal: totals.tryTotal,
usdTotal: totals.usdTotal,
rawTryTotal: totals.rawTryTotal,
liveTryTotal: totals.liveTryTotal,
rowCount: items.length,
includedCount: totals.includedCount,
firstTryAmount: items.length > 0 ? resolveGroupRowTRYAmount(items[0]) : 0
usdTotal: totals.usdTotal
}
})
))
watch(
detailGroupsWithTotals,
groups => {
const timestamp = new Date().toISOString()
console.groupCollapsed(`[PCD-GROUP-TOTALS] ${timestamp}`)
console.table((Array.isArray(groups) ? groups : []).map(group => ({
grup: String(group?.sAciklama3 || 'TANIMSIZ'),
satir: group?.rowCount || 0,
dahil: group?.includedCount || 0,
hamTRY: group?.rawTryTotal || 0,
canliTRY: group?.liveTryTotal || 0,
toplamTRY: group?.tryTotal || 0,
toplamUSD: group?.usdTotal || 0
})))
;(Array.isArray(groups) ? groups : []).forEach(group => {
console.groupCollapsed(`[PCD-GROUP-ROWS] ${String(group?.sAciklama3 || 'TANIMSIZ')}`)
console.table((Array.isArray(group?.items) ? group.items : []).map(row => ({
key: row?.__rowKey,
kod: row?.sKodu,
dahil: shouldIncludeRowInGroupTotal(group, row),
miktarInput: row?.miktarInput,
lMiktar: row?.lMiktar,
inputPrice: row?.inputPrice,
paraBirimi: row?.inputPricePrBr,
lFiyat: row?.lFiyat,
lTutar: row?.lTutar,
hesapTRY: resolveGroupRowTRYAmount(row),
usdTutar: row?.usdTutar,
hesapUSD: resolveGroupRowUSDAmount(row)
})))
console.groupEnd()
})
console.groupEnd()
},
{ deep: true, immediate: true, flush: 'post' }
)
function resolveGroupQuantity (grp) {
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
total + resolveNumericRowQuantity(row)