phpvms icon indicating copy to clipboard operation
phpvms copied to clipboard

Added is_flying Attribute to User Model

Open BossOfGames opened this issue 1 year ago • 2 comments

Based on feedback and conversations on discord. I added a isflying boolean.

BossOfGames avatar Dec 19 '23 11:12 BossOfGames

@BossOfGames is this still active?

nabeelio avatar Mar 05 '24 16:03 nabeelio

I would change this to use latest('updated_at'). In case there is a bugged/old PIREP.

Even with the change you suggest @nabeelio , there is still a risk of getting false positives. If there are broken pireps in the database, this will always return true because of the state check in where clause 😞

To avoid this maybe we can use the user's latest pirep only and return the result according to it's state. At least this will recude the risk to a single pirep being broken or not.

$pirep = Pirep::where('user_id' => $this->id)->latest('updated_at')->first();
return ($pirep->state === PirepState::IN_PROGRESS) ? true : false;

Similar logic can be implemented for aircraft too (maybe with some new enums defined, like BOOKED, PLANNED etc.)

And considering no replies since 5th March, I think OP does not follow or not interested in this change anymore.

FatihKoz avatar Jul 15 '24 21:07 FatihKoz