Skip to content

Commit

Permalink
Merge pull request #1046 from Heroes-Profile/TalentBuildScalarRemoval
Browse files Browse the repository at this point in the history
Removes scalar on builds
  • Loading branch information
Zemill authored Aug 1, 2024
2 parents a6ec5a8 + 7f04d51 commit 355a241
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/Http/Controllers/Global/GlobalTalentStatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function getGlobalHeroTalentBuildData(Request $request)
$talentbuildType = $request['talentbuildtype'];

$cacheKey = 'GlobalHeroTalentStatsBuilds|'.implode(',', \App\Models\SeasonGameVersion::select('id')->whereIn('game_version', $gameVersion)->pluck('id')->toArray()).'|'.hash('sha256', json_encode($request->all()));

//return $cacheKey;

$data = Cache::remember($cacheKey, $this->globalDataService->calculateCacheTimeInMinutes($gameVersion), function () use (
Expand Down Expand Up @@ -474,8 +475,12 @@ private function getTopBuildsData($build, $win_loss, $hero, $gameVersion, $gameT
->get();

$transformedData = [
/*
'wins' => ($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played') * 1.125)),
'losses' => ($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played') * 1.125)),
*/
'wins' => ($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played'))),
'losses' => ($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played'))),
'total_filter_type' => $statFilter !== 'win_rate' ? ($transformedData['total_filter_type'] + $data->sum('total_filter_type')) : 0,
];

Expand Down Expand Up @@ -507,8 +512,12 @@ private function getTopBuildsData($build, $win_loss, $hero, $gameVersion, $gameT
->get();

$transformedData = [
/*
'wins' => ($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played') * 1.33)),
'losses' => ($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played') * 1.33)),
*/
'wins' => ($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played'))),
'losses' => ($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played'))),
'total_filter_type' => $statFilter !== 'win_rate' ? ($transformedData['total_filter_type'] + $data->sum('total_filter_type')) : 0,
];

Expand Down Expand Up @@ -540,8 +549,12 @@ private function getTopBuildsData($build, $win_loss, $hero, $gameVersion, $gameT
->get();

$transformedData = [
/*
'wins' => round($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played') * 1.5)),
'losses' => round($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played') * 1.5)),
*/
'wins' => round($transformedData['wins'] + ($data->where('win_loss', 1)->sum('games_played'))),
'losses' => round($transformedData['losses'] + ($data->where('win_loss', 0)->sum('games_played'))),
'total_filter_type' => $statFilter !== 'win_rate' ? ($transformedData['total_filter_type'] + $data->sum('total_filter_type')) : 0,
];

Expand Down

0 comments on commit 355a241

Please sign in to comment.