From 2bb7fdbc278fa2efe2ac4d7f7d43a25081acd3fc Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 15 Jun 2026 10:54:43 +0200 Subject: [PATCH] wip --- BUGS.md | 2 +- app/Filament/Widgets/StatsMedianAverage.php | 10 +++++++--- public/js/app/number-animator.js | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/BUGS.md b/BUGS.md index af68c4f2..7edf5133 100644 --- a/BUGS.md +++ b/BUGS.md @@ -19,7 +19,7 @@ ## 6) Aggiungere nel Grafico Performance anche i dati della partita (Data / Home / Away / Risultato) come per gli altri grafici ## 7) Il Grafico della Moving Average per Events Performance secondo me è sbagliato quindi probabilmnete c'è un errore nel calcolo della Moving Average ## 8) Nel Riepilogo in verde, quando si seleziona SIMILAR PAST MATCHES sono invertiti WIN con LOST -9) Nel Riepilogo in verde, quando si seleziona SIMILAR PAST MATCHES è opportuno sostituire Win con 1, Draw con X e Lost con 2 +## 9) Nel Riepilogo in verde, quando si seleziona SIMILAR PAST MATCHES è opportuno sostituire Win con 1, Draw con X e Lost con 2 ## 10) Nel Riepilogo in verde, quando si seleziona SIMILAR PAST MATCHES sono sbagliate le Average Goals 11) Nel Riepilogo in verde, quando si seleziona SIMILAR PAST MATCHES i valori delle quote dovrebbero avere due decimali fissi 12) Filtrando per PLAYER sono sbagliate le Average Goals, sia Totali che Home/Away diff --git a/app/Filament/Widgets/StatsMedianAverage.php b/app/Filament/Widgets/StatsMedianAverage.php index 01c55e7e..c21a698e 100644 --- a/app/Filament/Widgets/StatsMedianAverage.php +++ b/app/Filament/Widgets/StatsMedianAverage.php @@ -103,14 +103,18 @@ class StatsMedianAverage extends StatsOverviewWidget $value_away = 0; // dd($value_home); + if ($data['similar_past_matches'] != 'none') + $fixtotwo = true; + else + $fixtotwo = false; return [ Stat::make('Number of events', new HtmlString('
' . $total_home . '
'))->extraAttributes(['x-init' => "animate('number-of-events', $total_home)"]), Stat::make('Average ' . $statistic_type, self::template('avhome', 'avaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('avhome', $value_home); animate('avaway', $value_away)"]), Stat::make('Median ' . $statistic_type, self::template('mehome', 'meaway', $home_team, $away_team))->extraAttributes(['x-init' => "animate('mehome', $median_home); animate('meaway', $median_away)"]), - Stat::make($data['similar_past_matches'] != 'none' ? '1' : 'Win: ' . $data['results']['w'], new HtmlString('
' . $win . '
'))->extraAttributes(['x-init' => "animate('number-of-win', $win)"]), - Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('
' . $draw . '
'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw)"]), - Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('
' . $lost . '
'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost)"]), + Stat::make($data['similar_past_matches'] != 'none' ? '1' : 'Win: ' . $data['results']['w'], new HtmlString('
' . $win . '
'))->extraAttributes(['x-init' => "animate('number-of-win', $win, 500, $fixtotwo)"]), + Stat::make($data['similar_past_matches'] != 'none' ? 'X' : 'Draw: ' . $data['results']['d'], new HtmlString('
' . $draw . '
'))->extraAttributes(['x-init' => "animate('number-of-draw', $draw, 500, $fixtotwo)"]), + Stat::make($data['similar_past_matches'] != 'none' ? '2' : 'Lost: ' . $data['results']['l'], new HtmlString('
' . $lost . '
'))->extraAttributes(['x-init' => "animate('number-of-lost', $lost, 500, $fixtotwo)"]), ]; } diff --git a/public/js/app/number-animator.js b/public/js/app/number-animator.js index 048a79db..69b16fef 100644 --- a/public/js/app/number-animator.js +++ b/public/js/app/number-animator.js @@ -1,4 +1,4 @@ -function animate(element, end, duration = 500) { +function animate(element, end, duration = 500, fixtotwo = false) { console.log(element, end); var element = document.getElementById(element); @@ -21,7 +21,8 @@ function animate(element, end, duration = 500) { // Calculate current value and round to integer const currentCount = Math.round(end * easedProgress * 100) / 100; - element.innerHTML = currentCount; + if (fixtotwo) element.innerHTML = currentCount.toFixed(2); + else element.innerHTML = currentCount; if (progress < 1) { requestAnimationFrame(updateCount);