0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Fix formatting error on Stats page (#20978)

[ANAL-79](https://linear.app/tryghost/issue/ANAL-79/stats-page-v10-design-refinements)

- There was a formatting error on the Stats page that was causing the
KPIs to be displayed incorrectly. This commit fixes that error.
This commit is contained in:
Peter Zimon 2024-09-11 17:02:31 +02:00 committed by GitHub
parent 8d29479981
commit 028c1a6929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,15 +84,15 @@ export default class KpisOverview extends Component {
const _KPITotal = kpi => queryData.reduce((prev, curr) => (curr[kpi] ?? 0) + prev, 0);
// Get total number of sessions
const totalVisits = formatNumber(_KPITotal('visits'));
const totalVisits = _KPITotal('visits');
// Sum total KPI value from the trend, ponderating using sessions
const _ponderatedKPIsTotal = kpi => queryData.reduce((prev, curr) => prev + ((curr[kpi] ?? 0) * curr.visits / totalVisits), 0);
return {
avg_session_sec: Math.floor(_ponderatedKPIsTotal('avg_session_sec') / 60),
pageviews: _KPITotal('pageviews'),
visits: totalVisits,
pageviews: formatNumber(_KPITotal('pageviews')),
visits: formatNumber(totalVisits),
bounce_rate: _ponderatedKPIsTotal('bounce_rate').toFixed(2)
};
}