Fix stats generator and display scale

This commit is contained in:
Jérémy Munsch 2021-11-03 11:36:38 +01:00
parent 9f6ae7bd09
commit e678d22483
No known key found for this signature in database
GPG key ID: 55196BEE445F6049
2 changed files with 9 additions and 7 deletions

View file

@ -23,19 +23,21 @@ class BrandStatSeeder extends Seeder
foreach ($brands as $brand) {
$startDay = Carbon::now();
$total = rand(100, 99999);
$active = rand(10, 89) / 100;
$new = rand(10, 89) / 100;
$active = rand(2, 20) / 100;
$new = rand(10, 30) / 100;
for ($i = 730; $i > 0; $i--) {
$total += floor($i / 2);
// pourcentage active
$pActive = $active * ((731 - $i) * 100 / 730);
$pActive = $active + ((731 - $i + 150) * 100 / 730) / 100;
$pInactive = 1 - $pActive;
// pourcentage nouveau
$pNew = $new * ($i * 100 / 730);
$pNew = $new;
$pOld = 1 - $pNew;
$brandStat = new BrandStat([
'active' => \floor($total * $pActive),
'inactive' => \ceil($total * $pActive),
'old_accounts' => \ceil($total * $pNew),
'inactive' => \ceil($total * $pInactive),
'old_accounts' => \ceil($total * $pOld),
'new_accounts' => \floor($total * $pNew),
'total_accounts' => $total,
'total_opt_in' => ceil($total * 0.15) // 15% optin

View file

@ -193,7 +193,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
},
y: {
display: true,
beginAtZero: true,
beginAtZero: false,
type: 'logarithmic'
}
},