Skip to content

Commit fee1ba3

Browse files
committed
Merge branch 'main' of github.com:eurofurence/fursuit-reg-tool
2 parents 158880a + 2f603d7 commit fee1ba3

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app/Domain/CatchEmAll/Models/AchievementUpdateContext.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Domain\CatchEmAll\Models;
44

55
use App\Domain\CatchEmAll\Enums\SpecialCodeType;
6+
use App\Models\Event;
67
use App\Models\User;
78

89
/**
@@ -35,10 +36,17 @@ public static function fromCatch(User $user, ?UserCatch $userCatch = null, ?Spec
3536
throw new \InvalidArgumentException('Either userCatch or specialCodeType must be provided');
3637
}
3738

39+
$currentEvent = Event::latest('starts_at')->first();
40+
3841
// Calculate user statistics
39-
$userTotalCatches = UserCatch::where('user_id', $user->id)->count();
40-
$totalCatchableFursuits = \App\Models\Fursuit\Fursuit::count();
42+
$userTotalCatches = UserCatch::where('user_id', $user->id)
43+
->where('event_id', operator: $currentEvent->id)
44+
->count();
45+
$totalCatchableFursuits = \App\Models\Fursuit\Fursuit::where('event_id', operator: $currentEvent->id)
46+
->where('catch_em_all', true)
47+
->count();
4148
$userUniqueFursuits = UserCatch::where('user_id', $user->id)
49+
->where('event_id', operator: $currentEvent->id)
4250
->distinct('fursuit_id')
4351
->count();
4452

0 commit comments

Comments
 (0)