fix: calculate dashboard summary profit rate
This commit is contained in:
parent
854048d6e8
commit
b7f674b097
@ -761,6 +761,10 @@ function resolveLuckyGiftProfitRate(record?: null | {
|
|||||||
if (!record) {
|
if (!record) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
const flow = toAmount(record.luckyGiftTotalFlow);
|
||||||
|
if (flow !== 0) {
|
||||||
|
return (toAmount(record.luckyGiftProfit) / flow) * 100;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
record.luckyGiftProfitRate !== undefined &&
|
record.luckyGiftProfitRate !== undefined &&
|
||||||
record.luckyGiftProfitRate !== null &&
|
record.luckyGiftProfitRate !== null &&
|
||||||
@ -771,11 +775,7 @@ function resolveLuckyGiftProfitRate(record?: null | {
|
|||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const flow = Number(record.luckyGiftTotalFlow || 0);
|
return 0;
|
||||||
if (!Number.isFinite(flow) || flow === 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (Number(record.luckyGiftProfit || 0) / flow) * 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveMetricRate(record: Record<string, any>, key: string) {
|
function resolveMetricRate(record: Record<string, any>, key: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user