Fix product performance grouped JSON build
This commit is contained in:
@@ -2685,7 +2685,15 @@ function resolveAutoOrICodeHighlightClass (row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolveNumericRowQuantity (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) {
|
function resolveNumericRowInputPrice (row) {
|
||||||
@@ -2867,15 +2875,22 @@ function resolveRowTRYTutar (row) {
|
|||||||
const quantity = resolveNumericRowQuantity(row)
|
const quantity = resolveNumericRowQuantity(row)
|
||||||
const inputPrice = resolveNumericRowInputPrice(row)
|
const inputPrice = resolveNumericRowInputPrice(row)
|
||||||
const inputCurrency = resolveInputCurrency(row)
|
const inputCurrency = resolveInputCurrency(row)
|
||||||
const liveAmount = resolveTRYUnitPriceByInput(
|
const calculatedUnitPrice = resolveTRYUnitPriceByInput(
|
||||||
inputPrice,
|
inputPrice,
|
||||||
inputCurrency,
|
inputCurrency,
|
||||||
resolveExchangeRateValue('USD'),
|
resolveExchangeRateValue('USD'),
|
||||||
resolveExchangeRateValue('EUR'),
|
resolveExchangeRateValue('EUR'),
|
||||||
resolveExchangeRateValue('GBP')
|
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)
|
return parseMoneyInput(row?.lTutar)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2899,7 +2914,7 @@ function resolveRowUSDTutar (row) {
|
|||||||
resolveExchangeRateValue('GBP')
|
resolveExchangeRateValue('GBP')
|
||||||
) * quantity
|
) * quantity
|
||||||
|
|
||||||
if (Number.isFinite(liveAmount) && inputPrice > 0) return liveAmount
|
if (Number.isFinite(liveAmount) && inputPrice > 0 && quantity > 0) return liveAmount
|
||||||
|
|
||||||
const rawUSDAmount = row?.usdTutar
|
const rawUSDAmount = row?.usdTutar
|
||||||
if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') {
|
if (rawUSDAmount !== undefined && rawUSDAmount !== null && String(rawUSDAmount).trim() !== '') {
|
||||||
|
|||||||
Reference in New Issue
Block a user