Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-18 23:38:24 +03:00
parent 25ef023df5
commit 31a71ab566
@@ -2912,22 +2912,9 @@ function shouldIncludeRowInGroupTotal (grp, row) {
}
function refreshLiveGroupTotals () {
detailGroups.value = detailGroups.value.map(group => {
const totals = (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => {
if (!shouldIncludeRowInGroupTotal(group, row)) return acc
acc.tryTotal += resolveRowTRYTutar(row)
acc.usdTotal += resolveRowUSDTutar(row)
acc.quantity += resolveNumericRowQuantity(row)
return acc
}, { tryTotal: 0, usdTotal: 0, quantity: 0 })
return {
...group,
liveTryTotal: totals.tryTotal,
liveUsdTotal: totals.usdTotal,
liveQuantity: totals.quantity
}
})
// Totals are derived directly from reactive rows. The revision only forces
// Quasar's table/sub-header render after an in-place row edit.
groupTotalsRevision.value += 1
}
const pendingRenderedAmounts = new Map()
@@ -2975,25 +2962,35 @@ function renderedRowsForGroup (groupIndex) {
}
function resolveRenderedGroupIncludedCount (groupIndex) {
return renderedRowsForGroup(groupIndex).filter(row => row.included).length
const grp = detailGroups.value[groupIndex]
return (Array.isArray(grp?.items) ? grp.items : []).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length
}
function resolveRenderedGroupRowCount (groupIndex) {
return renderedRowsForGroup(groupIndex).length
const grp = detailGroups.value[groupIndex]
return Array.isArray(grp?.items) ? grp.items.length : 0
}
function resolveGroupTRYTutar (groupIndex, _revision) {
const grp = detailGroups.value[groupIndex]
return parseMoneyInput(grp?.liveTryTotal)
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => {
if (!shouldIncludeRowInGroupTotal(grp, row)) return total
return total + parseMoneyInput(row?.lTutar)
}, 0)
}
function resolveGroupUSDTutar (groupIndex, _revision) {
const grp = detailGroups.value[groupIndex]
return parseMoneyInput(grp?.liveUsdTotal)
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => {
if (!shouldIncludeRowInGroupTotal(grp, row)) return total
return total + parseMoneyInput(row?.usdTutar ?? row?.lTutarUSD)
}, 0)
}
function resolveGroupQuantity (grp) {
return parseMoneyInput(grp?.liveQuantity)
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
total + resolveNumericRowQuantity(row)
), 0)
}
function groupKey (grp, gi) {