use new formula to calc ivl in getRetentionWarning (#2911)

* use new formula to calc ivl in getRetentionWarning

* format

* Use consistent casing (dae)
This commit is contained in:
Jarrett Ye 2023-12-27 10:26:58 +08:00 committed by GitHub
parent 55ef11af84
commit 0266de60b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
function getRetentionWarning(retention: number): string {
const days = Math.round(9 * 100 * (1.0 / retention - 1.0));
const decay = -0.5;
const factor = 0.9 ** (1 / decay) - 1;
const stability = 100;
const days = Math.round(
(stability / factor) * (Math.pow(retention, 1 / decay) - 1),
);
if (days === 100) {
return "";
}