feat: change average to median

This commit is contained in:
Nikola Ubavic 2022-08-15 16:13:25 +02:00 committed by Rafael
parent b5e798339b
commit 1d37608a19
3 changed files with 14 additions and 16 deletions

View file

@ -227,13 +227,11 @@ const Analytics = () => {
previous: filteredData(period.code).previous.length
}
const avgAmount = {
current:
R.sum(R.map(d => d.fiat, filteredData(period.code).current)) /
(txs.current === 0 ? 1 : txs.current),
previous:
R.sum(R.map(d => d.fiat, filteredData(period.code).previous)) /
(txs.previous === 0 ? 1 : txs.previous)
const median = values => (values.length === 0 ? 0 : R.median(values))
const medianAmount = {
current: median(R.map(d => d.fiat, filteredData(period.code).current)),
previous: median(R.map(d => d.fiat, filteredData(period.code).previous))
}
const txVolume = {
@ -365,9 +363,9 @@ const Analytics = () => {
/>
<div className={classes.verticalLine} />
<OverviewEntry
label="Avg. txn amount"
value={avgAmount.current}
oldValue={avgAmount.previous}
label="Median amount"
value={medianAmount.current}
oldValue={medianAmount.previous}
currency={fiatLocale}
/>
<div className={classes.verticalLine} />