Skip to content

Commit 10fede9

Browse files
committed
Fixed that fursuits of old events can be catched
+ Removed another occurences of the faulty function for filtering for an event
1 parent 2a9ab59 commit 10fede9

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

app/Domain/CatchEmAll/Controllers/GameController.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function index(Request $request)
3838

3939
// Get current event
4040
$currentEvent = $this->getCurrentEvent();
41-
$filterEvent = $this->getFilterEvent($selectedEventId, $isGlobal, $currentEvent);
41+
$filterEvent = $currentEvent; //$this->getFilterEvent($selectedEventId, $isGlobal, $currentEvent);
4242

4343
// Get user's game stats
4444
$gameStats = $this->gameStatsService->getUserStats($user, $filterEvent, $isGlobal);
@@ -67,7 +67,7 @@ public function index(Request $request)
6767
'collection' => $collection,
6868
'achievements' => $achievements,
6969
'eventsWithEntries' => $eventsWithEntries,
70-
'selectedEvent' => $selectedEventId ?: ($filterEvent?->id ?? 'global'),
70+
'selectedEvent' => $filterEvent?->id ?? 'global',
7171
'isGlobal' => $isGlobal,
7272
'recentCatch' => $recentCatch,
7373
]);
@@ -99,7 +99,10 @@ public function catch(UserCatchRequest $request)
9999
->where('code', $catchCode)
100100
->first();
101101

102-
$fursuit = $this->findFursuitByCode($catchCode);
102+
$fursuit = Fursuit::where('event_id', $event->id)
103+
->where('catch_code', $catchCode)
104+
->where('catch_em_all', true)
105+
->first();
103106

104107
// If neither exists, it's an invalid code
105108
if (!$specialCode && !$fursuit) {
@@ -361,13 +364,6 @@ private function createCatchLog($event, $user, $catchCode): UserCatchLog
361364
]);
362365
}
363366

364-
private function findFursuitByCode(string $code): ?Fursuit
365-
{
366-
return Fursuit::where('catch_code', $code)
367-
->where('catch_em_all', true)
368-
->first();
369-
}
370-
371367
private function isRateLimited(int $userId): int
372368
{
373369
$key = "fursuit_catch:{$userId}";

0 commit comments

Comments
 (0)