Fix product performance grouped JSON build
This commit is contained in:
@@ -2912,22 +2912,9 @@ function shouldIncludeRowInGroupTotal (grp, row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshLiveGroupTotals () {
|
function refreshLiveGroupTotals () {
|
||||||
detailGroups.value = detailGroups.value.map(group => {
|
// Totals are derived directly from reactive rows. The revision only forces
|
||||||
const totals = (Array.isArray(group?.items) ? group.items : []).reduce((acc, row) => {
|
// Quasar's table/sub-header render after an in-place row edit.
|
||||||
if (!shouldIncludeRowInGroupTotal(group, row)) return acc
|
groupTotalsRevision.value += 1
|
||||||
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
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pendingRenderedAmounts = new Map()
|
const pendingRenderedAmounts = new Map()
|
||||||
@@ -2975,25 +2962,35 @@ function renderedRowsForGroup (groupIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolveRenderedGroupIncludedCount (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) {
|
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) {
|
function resolveGroupTRYTutar (groupIndex, _revision) {
|
||||||
const grp = detailGroups.value[groupIndex]
|
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) {
|
function resolveGroupUSDTutar (groupIndex, _revision) {
|
||||||
const grp = detailGroups.value[groupIndex]
|
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) {
|
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) {
|
function groupKey (grp, gi) {
|
||||||
|
|||||||
Reference in New Issue
Block a user