mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 14:15:22 +00:00
Fix average retention calculation
This commit is contained in:
parent
cdf603239e
commit
51f52a21f7
|
@ -92,7 +92,9 @@ export default class Retention extends PureComponent {
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{data[0].data.slice(1).map((retention, i) => {
|
{data[0].data.slice(1).map((retention, i) => {
|
||||||
const average = data.reduce((sum, cohort, k) => cohort.data[i + 1] ? sum + (cohort.data[i + 1].rate - sum)/(k + 1) : sum, 0);
|
const sum_of_active = data.reduce((sum, cohort) => cohort.data[i + 1] ? sum + (cohort.data[i + 1].value * 1) : sum, 0);
|
||||||
|
const sum_of_new = data.reduce((sum, cohort) => cohort.data[0].value ? sum + (cohort.data[0].value * 1) : sum, 0);
|
||||||
|
const average = sum_of_active / sum_of_new;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<td key={retention.date}>
|
<td key={retention.date}>
|
||||||
|
|
Loading…
Reference in a new issue