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:
parent
8d29479981
commit
028c1a6929
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue