From 7b7afd27ea0bc9b220bb069d9e12ba04406a251c Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 8 Sep 2024 08:16:44 -0400 Subject: [PATCH 1/3] Adds game map filter --- .../Player/PlayerHeroesMapsRolesController.php | 3 ++- .../Player/Heroes/PlayerHeroSingleStats.vue | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php index de754a5e..9ce3d984 100644 --- a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php +++ b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php @@ -75,6 +75,7 @@ public function getData(Request $request) $page = $request['page']; $role = $request['role']; $game_map = $request['game_map'] ? Map::where('name', $request['game_map'])->pluck('map_id')->first() : null; + $season = $request['season']; $result = Replay::join('player', 'player.replayID', '=', 'replay.replayID') @@ -106,7 +107,7 @@ public function getData(Request $request) ->when($type == 'single' && $page == 'role', function ($query) use ($role) { return $query->where('new_role', $role); }) - ->when($type == 'single' && $page == 'map', function ($query) use ($game_map) { + ->when($type == 'single' && ($page == 'map' || $page == 'hero'), function ($query) use ($game_map) { return $query->where('game_map', $game_map); }) ->when(! is_null($season), function ($query) use ($season) { diff --git a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue index ad3ae916..c73202e6 100644 --- a/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue +++ b/resources/js/components/Player/Heroes/PlayerHeroSingleStats.vue @@ -7,6 +7,7 @@
{{ section.title }} | @@ -168,7 +172,7 @@||||
{{ row.label }} | +{{ row.label }} | {{ formatValue(row.key, this.data["sum_" + row.key])}} | {{ formatValue(row.key, this.data["avg_" + row.key]) }} | {{ formatValue(row.key, this.data["max_" + row.key]) }} | @@ -275,7 +279,7 @@ ], }, { - title: 'Defense/Healing', + title: 'Defense/ Healing', rows: [ { label: 'Healing', key: 'healing' }, { label: 'Self Healing', key: 'self_healing' }, From 9e958a71e8110d1d6f9b24ca1458d4a00fd6ea02 Mon Sep 17 00:00:00 2001 From: Zemill <33404722+Zemill@users.noreply.github.com> Date: Sun, 8 Sep 2024 17:02:46 -0400 Subject: [PATCH 3/3] Fixes it so it doesnt try and filter when map is null --- app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php index 9ce3d984..022f7281 100644 --- a/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php +++ b/app/Http/Controllers/Player/PlayerHeroesMapsRolesController.php @@ -107,7 +107,7 @@ public function getData(Request $request) ->when($type == 'single' && $page == 'role', function ($query) use ($role) { return $query->where('new_role', $role); }) - ->when($type == 'single' && ($page == 'map' || $page == 'hero'), function ($query) use ($game_map) { + ->when($game_map && $type == 'single' && ($page == 'map' || $page == 'hero'), function ($query) use ($game_map) { return $query->where('game_map', $game_map); }) ->when(! is_null($season), function ($query) use ($season) {