Allow "Log 1st Flight" achievement to be awarded even if flight is upcoming
This commit is contained in:
1 parent
7bca9a8d31
commit
90ea8d81d2
4 files changed
+35
-8
No files matched your search
@@ -47,6 +47,7 @@ class AchievementService
|
||||
* @var Collection<int,UserFlight> $flights
|
||||
*/
|
||||
private Collection $flights;
|
||||
private int $loggedFlightCount;
|
||||
|
||||
public function calculate(User $user): void
|
||||
{
|
||||
@@ -64,20 +65,24 @@ class AchievementService
|
||||
'arrivalAirport.region.continent',
|
||||
])->where('departure_date', '<=', now('UTC'))->get();
|
||||
|
||||
$this->loggedFlightCount = $user->flights()->count();
|
||||
|
||||
foreach ($this->checkers as $checkerClass) {
|
||||
$checker = new $checkerClass($this);
|
||||
$checker->check($user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int,UserFlight>
|
||||
*/
|
||||
public function getFlights(): Collection
|
||||
{
|
||||
return $this->flights;
|
||||
}
|
||||
|
||||
public function getLoggedFlightCount(): int
|
||||
{
|
||||
return $this->loggedFlightCount;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Award / revoke
|
||||
|
||||
Reference in new issue
Block a user