Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-18 22:35:20 +03:00
parent 65e8aa2b62
commit 20f5fea2e8
@@ -2685,7 +2685,15 @@ function resolveAutoOrICodeHighlightClass (row) {
}
function resolveNumericRowQuantity (row) {
return parseMoneyInput(row?.miktarInput ?? row?.lMiktar)
const editableQuantity = parseMoneyInput(row?.miktarInput)
const storedQuantity = parseMoneyInput(row?.lMiktar)
// Some detail payloads/local drafts contain miktarInput=0 even though the
// recipe quantity in lMiktar is populated. Nullish coalescing selected that
// zero and consequently every amount was calculated as zero.
if (editableQuantity > 0) return editableQuantity
if (storedQuantity > 0) return storedQuantity
return 0
}
function resolveNumericRowInputPrice (row) {
@@ -2867,15 +2875,22 @@ function resolveRowTRYTutar (row) {
const quantity = resolveNumericRowQuantity(row)
const inputPrice = resolveNumericRowInputPrice(row)
const inputCurrency = resolveInputCurrency(row)
const liveAmount = resolveTRYUnitPriceByInput(
const calculatedUnitPrice = resolveTRYUnitPriceByInput(
inputPrice,
inputCurrency,
resolveExchangeRateValue('USD'),
resolveExchangeRateValue('EUR'),
resolveExchangeRateValue('GBP')
) * quantity
)
// lFiyat is already the TRY unit price rendered in the table. Keep it as a
// fallback for hydrated/autofilled rows whose original input fields lag one
// render behind.
const unitPrice = calculatedUnitPrice > 0
? calculatedUnitPrice
: parseMoneyInput(row?.lFiyat)
const liveAmount = unitPrice * quantity
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
if (Number.isFinite(liveAmount) && unitPrice > 0 && quantity > 0) return liveAmount
return parseMoneyInput(row?.lTutar)
}
@@ -2899,7 +2914,7 @@ function resolveRowUSDTutar (row) {
resolveExchangeRateValue('GBP')
) * quantity
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
if (Number.isFinite(liveAmount) && inputPrice > 0 && quantity > 0) return liveAmount
const rawUSDAmount = row?.usdTutar
if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') {