Update percentage decimal places
This commit is contained in:
parent
5df576c6be
commit
da7b915cca
|
@ -83,7 +83,7 @@ function Stats({ data }) {
|
||||||
of <strong>{formatBytes(totals.bandwidth.all)}</strong> of data to{' '}
|
of <strong>{formatBytes(totals.bandwidth.all)}</strong> of data to{' '}
|
||||||
<strong>{formatNumber(totals.uniques.all)}</strong> unique visitors,{' '}
|
<strong>{formatNumber(totals.uniques.all)}</strong> unique visitors,{' '}
|
||||||
<strong>
|
<strong>
|
||||||
{formatPercent(totals.requests.cached / totals.requests.all, 0)}%
|
{formatPercent(totals.requests.cached / totals.requests.all, 2)}%
|
||||||
</strong>{' '}
|
</strong>{' '}
|
||||||
of which were served from the cache.
|
of which were served from the cache.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export default function formatPercent(n, fixed = 1) {
|
export default function formatPercent(n, decimals = 1) {
|
||||||
return String((n.toPrecision(2) * 100).toFixed(fixed));
|
return (n * 100).toPrecision(decimals + 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue