mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-04-26 02:00:32 -05:00
Leaderboard fix wrong request structure
This commit is contained in:
parent
85ecfa5560
commit
a7620c2604
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Enums\Game\Faction;
|
||||
use App\Enums\Game\Hunter;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Api\Leaderboard\GetScoresRequest;
|
||||
use App\Http\Responses\Api\Leaderboard\GetScoresResponse;
|
||||
|
|
@ -13,7 +12,6 @@
|
|||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LeaderboardController extends Controller
|
||||
{
|
||||
|
|
@ -126,9 +124,10 @@ public static function getLeaderboardSize(Faction $faction, Carbon $startDate, ?
|
|||
$query->whereDate('created_at', '>=', $startDate);
|
||||
$query->whereDate('created_at', '<=', $endDate);
|
||||
$query->whereIn('played_character', $faction->getCharacterList());
|
||||
$query->groupBy('user_id');
|
||||
$query->distinct('user_id');
|
||||
$query->selectRaw('user_id');
|
||||
|
||||
return $query->count();
|
||||
return $query->count('user_id');
|
||||
}
|
||||
|
||||
protected static function getBaseSelectQuery(Faction $faction, Carbon $startDate, Carbon $endDate): Builder
|
||||
|
|
@ -136,7 +135,7 @@ protected static function getBaseSelectQuery(Faction $faction, Carbon $startDate
|
|||
$subSubQuery = ArchivedPlayerProgression::query();
|
||||
$subSubQuery->select(['user_id'])->addSelect(DB::raw('MAX(gained_experience) as gained_experience'));
|
||||
$subSubQuery->whereDate('created_at', '>=', $startDate);
|
||||
$subSubQuery->whereDate('created_at', '>=', $endDate);
|
||||
$subSubQuery->whereDate('created_at', '<=', $endDate);
|
||||
$subSubQuery->whereIn('played_character', $faction->getCharacterList());
|
||||
$subSubQuery->groupBy('user_id');
|
||||
$subSubQuery->orderByDesc('gained_experience');
|
||||
|
|
|
|||
|
|
@ -36,19 +36,19 @@ public function authorize(): bool
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'playerIds' => ['required', 'array'],
|
||||
'playerIds.*' => 'string',
|
||||
'faction' => ['required', new Enum(Faction::class)],
|
||||
'top' => ['required', 'integer',],
|
||||
'window' => ['required', new Enum(Window::class)],
|
||||
'data.playerIds' => ['required', 'array'],
|
||||
'data.playerIds.*' => 'string',
|
||||
'data.faction' => ['required', new Enum(Faction::class)],
|
||||
'data.top' => ['required', 'integer',],
|
||||
'data.window' => ['required', new Enum(Window::class)],
|
||||
];
|
||||
}
|
||||
|
||||
public function passedValidation(): void
|
||||
{
|
||||
$this->playerIds = $this->input('playerIds');
|
||||
$this->faction = Faction::tryFrom($this->input('faction'));
|
||||
$this->top = (int)$this->input('top');
|
||||
$this->window = Window::tryFrom($this->input('window'));
|
||||
$this->playerIds = $this->input('data.playerIds');
|
||||
$this->faction = Faction::tryFrom($this->input('data.faction'));
|
||||
$this->top = (int)$this->input('data.top');
|
||||
$this->window = Window::tryFrom($this->input('data.window'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user