From 129157eb216893e643acece1759c8045fecd7e72 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 12 Dec 2023 15:07:08 +1000 Subject: [PATCH] Better approximate average retention/ease/difficulty Our average calculation is based on pre-binned values, so it's not entirely accurate, but using the midpoint of the bin brings us closer. In the future we can solve this by calculating it on the Rust end instead. --- ts/graphs/difficulty.ts | 2 +- ts/graphs/ease.ts | 2 +- ts/graphs/retrievability.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/graphs/difficulty.ts b/ts/graphs/difficulty.ts index 6acbe8cce..90421fe72 100644 --- a/ts/graphs/difficulty.ts +++ b/ts/graphs/difficulty.ts @@ -101,7 +101,7 @@ export function prepareData( const tableData = [ { label: tr.statisticsAverageDifficulty(), - value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => k * v)) / total), + value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => (k + 2.5) * v)) / total), }, ]; diff --git a/ts/graphs/ease.ts b/ts/graphs/ease.ts index e31782b15..543d3660c 100644 --- a/ts/graphs/ease.ts +++ b/ts/graphs/ease.ts @@ -106,7 +106,7 @@ export function prepareData( const tableData = [ { label: tr.statisticsAverageEase(), - value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => k * v)) / total), + value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => (k + 2.5) * v)) / total), }, ]; diff --git a/ts/graphs/retrievability.ts b/ts/graphs/retrievability.ts index 7ad036448..e99ba1393 100644 --- a/ts/graphs/retrievability.ts +++ b/ts/graphs/retrievability.ts @@ -101,7 +101,7 @@ export function prepareData( const tableData = [ { label: tr.statisticsAverageRetrievability(), - value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => k * v)) / total), + value: xTickFormat(sum(Array.from(allEases.entries()).map(([k, v]) => (k + 2.5) * v)) / total), }, ];