don't change rank if it's not auto promoted #168
This commit is contained in:
@@ -148,11 +148,17 @@ class UserService extends BaseService
|
|||||||
public function calculatePilotRank(User $user): User
|
public function calculatePilotRank(User $user): User
|
||||||
{
|
{
|
||||||
$user->refresh();
|
$user->refresh();
|
||||||
|
|
||||||
|
# If their current rank is one they were assigned, then
|
||||||
|
# don't change away from it automatically.
|
||||||
|
if($user->rank->auto_promote === false) {
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
$old_rank = $user->rank;
|
$old_rank = $user->rank;
|
||||||
$original_rank_id = $user->rank_id;
|
$original_rank_id = $user->rank_id;
|
||||||
$pilot_hours = Utils::minutesToHours($user->flight_time);
|
$pilot_hours = Utils::minutesToHours($user->flight_time);
|
||||||
|
|
||||||
# TODO: Cache
|
|
||||||
$ranks = Rank::where('auto_promote', true)
|
$ranks = Rank::where('auto_promote', true)
|
||||||
->orderBy('hours', 'asc')->get();
|
->orderBy('hours', 'asc')->get();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user